Server Connect truncates strings containing }} (nested JSON) causing Lexer Error 500

Wappler Version : v7.5.2 Windows 11 NodeJS Database Type: mysql

Expected behavior

The Goal: I am building a dynamic Server-Side Schema.org Generator for my website. Depending on the page type (Homepage, Service, Product), I need to construct a specific JSON-LD string dynamically within a Server Action.

'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"ProfessionalService","@id":"https://cg-events.de/#organization","name":"CG Events","url":"https://cg-events.de","logo":"https://cg-events.de/assets/images/logo_weiss.png","image":"https://cg-events.de/assets/banner/1920/'+hero.query_get_hero_image.image+'","description":"Full-Service-Eventagentur für Firmenevents, Teambuilding und Incentives in NRW und ganz Deutschland.","telephone":"+4923454450192","email":"info@cg-events.de","address":{"@type":"PostalAddress","streetAddress":"Hordeler Heide 172","addressLocality":"Bochum","postalCode":"44793","addressRegion":"NRW","addressCountry":"DE"},"geo":{"@type":"GeoCoordinates","latitude":"51.49924500819099","longitude":"7.174366438610437"},"areaServed":[{"@type":"AdministrativeArea","name":"Nordrhein-Westfalen"},{"@type":"Country","name":"Deutschland"}],"priceRange":"€€","openingHoursSpecification":[{"@type":"OpeningHoursSpecification","dayOfWeek":["Monday","Tuesday","Wednesday","Thursday","Friday"],"opens":"09:00","closes":"18:00"}],"sameAs":["https://www.instagram.com/cgveranstaltungen/","https://www.facebook.com/CGVeranstaltungen","https://www.pinterest.de/CG_Events_Bochum"],"aggregateRating":{"@type":"AggregateRating","ratingValue":"4.9","reviewCount":"41"}},{"@type":"WebSite","@id":"https://cg-events.de/#website","url":"https://cg-events.de","name":"CG Events","publisher":{"@id":"https://cg-events.de/#organization"}}]}</script>'

What should happen: When I use the "Set Value" step to create these JSON strings, they often contain nested objects (e.g. for aggregateRating or provider), which naturally end with double curly braces }}. I expect Wappler to save these strings exactly as typed, treating the }} as part of the text string, not as the closing tag of a Wappler expression.

Actual behavior

The Bug: The Wappler Expression Editor seems to misinterpret the }} inside a quoted string as the end of a Wappler binding expression.

After saving the Server Action and reopening the "Set Value" step, the code is truncated/cut off exactly at the }} position.

  • Original Input: '... "reviewCount": "41"}}'

  • After Save: '... "reviewCount":"41"+',{"

This results in a malformed string in the server action code (json), causing a Status 500 "Lexer Error: Unexpected token" on the frontend because the string is no longer properly closed. This prevents me from generating valid nested Schema markup server-side.

How to reproduce

  1. Create a new Server Action (NodeJS).

  2. Add a Set Value step (Name: schemaTest).

  3. In the Value field, paste this simple string test case (make sure to include the single quotes): '{"data": {"count": 41}}'

  4. Save the Server Action (Ctrl+S).

  5. Click on another step or refresh the Server Action panel, then click on the schemaTest step again to view the code.

  6. Observation: The code has been corrupted/truncated. The closing }}' is missing, breaking the syntax.

Workarounds tried: I tried escaping (\}), splitting strings ('}' + '}'), and different quoting styles, but the editor consistently corrupts the string upon saving/reopening.

Am I doing something wrong again?

Thanks for your help!!

I reported similar behavior a few weeks ago.

But I haven't received any response from anyone at Wappler... I don't know if this is how the response process is supposed to work, but I still don't know if it's a bug in the tool or an error on my part!

The Team is currently taking a short Christmas break Thiago. I'm sure it will be given the attention it is due upon their return to business.

Thank you for replying, it's just that my post is already 16 days old. Even so, thank you.

1 Like

This should really have been a Bug Report, and likewise for any similar issues. Bug Reports can be tracked and assigned. That may well be the reason you have not seen it assigned (despite the Team being on a break, the Team still assign Bugs once investigated). I've just added the Bugs tag to it. In future though please submit a Bug Report independently and not merged in to Topics/Threads of others for best results and attention (just advice).

Thank you for the guidance. I'm new to using the tool and I'm facing the challenge of inexperience, as well as a lack of clarity in the processes, not to mention the language barrier, since I have to use Google Translate. Therefore, I apologize if I give the impression of something that isn't true.

1 Like

No problem. You will find the Wappler Community is unlike many others out there. Everyone here is happy to help and offer guidance. Rarely do we ever see any 'looking down' upon any User. We are all in this boat together and have to look out for each other.

:smiling_face_with_three_hearts:

2 Likes

Strange, now it works as it should.

I didn't change anything.

The }} seems to be changed to } } in your latest reply. Adding a space in between fixed it. Currently it parses template strings with a simple regex expression which extracts the {{ until the first }} it finds and then parses the expression within it. For serverconnect values which start with {{ and end with }} we strip those off and evaluate the whole as an expression. So it normally should not only parse it to halfway.

Will see if I can improve the code to prevent some rare cases where this still happens and check if any previous update didn't brake something.

The problem doesn't seem to be with serverconnect but with the expression editor within Wappler that seems to corrupt expressions. We are working on an update but it will take a while since the component is widely used within Wappler and it needs some refactoring to fix most issues.

Does the corruption happen within the Wappler UI, probably related to

and

Fixed in Wappler 7.6.2

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.