Syntax error in JavaScript code after updating

Describe the problem/error/question

I just upgraded to the latest version and I have a syntax error in code that used to work.

{{ const responseUrl="https://myserver.com/webhook/webhook-url-here" }}

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <style>
.
.
.
 <div class="rating-buttons">
            <a href="{{$responseUrl}}?email={{$json.email}}&value=1"
.
.
.

What is the error message (if any)?

[invalid syntax] for the first line. I tried with and without a ; ate the end. Not sure why it’s failing

Share the output returned by the last node

NO output. I removed the “const” part of the line to look like this:

{{ responseUrl="https://myserver.com/webhook/webhook-url-here" }}

And this works.… except that the URL appears at the top of the document and this line

 <a href="{{$responseUrl}}?email={{$json.email}}&value=1"

Does not resulve $responseUrl.

Evidently something changed in the update process, but I’m not sure how to fix it.

L

Information on your n8n setup

  • n8n version: 1.107.3
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker Compose
  • Operating system: debian-12-bookworm-v20250513

Hey @DupervalAI hope all is good.

Could you share a workflow or a minimal example of the issue instead?

I see.

I assume you want an easy access to the url so that you dont have to scroll and change it at the bottom of the html

The most straightforward solution would be to add a Set node right before and set a key responseUrl with the value "https://myserver.com/webhook/webhook-url-here", then in the Email node reference it as {{ $json.responseUrl }}.

1 Like

Yes, that works, thanks! I’ll have to change my way of doing things.

L

1 Like

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