Skip to content

fix(api-service,worker): fail HTTP step on invalid Liquid template compilation#10623

Open
cursor[bot] wants to merge 2 commits intonextfrom
cursor/sentry-error-investigation-05f2
Open

fix(api-service,worker): fail HTTP step on invalid Liquid template compilation#10623
cursor[bot] wants to merge 2 commits intonextfrom
cursor/sentry-error-investigation-05f2

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Apr 8, 2026

What changed

Wrapped liquidEngine.parseAndRender() in a try-catch inside compileControlValues() in both:

  • API: TestHttpEndpointUsecase (apps/api/src/app/workflows-v2/usecases/test-http-endpoint/)
  • Worker: ExecuteHttpRequestStep (apps/worker/src/app/workflow/usecases/send-message/)

Why

Sentry Error: API-R0TokenizationError: invalid value expression: "{subscriber.data.voice"

When users write HTTP request step templates with invalid Liquid syntax (e.g., unclosed braces like {subscriber.data.voice instead of {{subscriber.data.voice}}), LiquidJS throws a TokenizationError that was previously unhandled. This caused a 500 Internal Server Error to bubble up to Sentry.

The JSON.parse fallback was already wrapped in try-catch, but the parseAndRender call immediately above it was not — an oversight since both operations can fail on malformed user input.

Fix

On TokenizationError (or any Liquid parse/render failure), the method now returns the original uncompiled control values as a graceful fallback. This is consistent with the existing JSON.parse fallback pattern and matches how translate.usecase.ts handles the same error class.

Remaining risk

Low. The fallback returns raw template strings with unresolved variables, which is the same behavior as the existing JSON.parse catch path. Users will see their literal template text rather than a 500 error.

Open in Web View Automation 

…te compilation

Wrap parseAndRender() in try-catch in compileControlValues() for both
the API test-http-endpoint and worker execute-http-request-step use cases.

When user templates contain invalid Liquid syntax (e.g. unclosed braces
like '{subscriber.data.voice'), LiquidJS throws a TokenizationError that
was previously unhandled, resulting in a 500 error. Now the original
uncompiled values are returned as a graceful fallback.

Fixes API-R0

Co-authored-by: Dima Grossman <dima@grossman.io>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 8, 2026

Deploy Preview for dashboard-v2-novu-staging ready!

Name Link
🔨 Latest commit f5a59d0
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/69d75040da3bb00008ccaaa1
😎 Deploy Preview https://deploy-preview-10623.dashboard-v2.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Hey there and thank you for opening this pull request! 👋

We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted.

Your PR title is: fix(api-service,worker): fail HTTP step on invalid Liquid template compilation

Requirements:

  1. Follow the Conventional Commits specification
  2. As a team member, include Linear ticket ID at the end: fixes TICKET-ID or include it in your branch name

Expected format: feat(scope): Add fancy new feature fixes NOV-123

Details:

PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name

@scopsy
Copy link
Copy Markdown
Contributor

scopsy commented Apr 9, 2026

@cursoragent we should not fallback to the uncompiled version, if the compilation is broken we should throw an error

@cursor
Copy link
Copy Markdown
Contributor Author

cursor bot commented Apr 9, 2026

Here is what I implemented in response to @scopsy’s review (“do not fallback; throw on broken compilation”).

Changes

  1. TestHttpEndpointUsecase (apps/api/src/app/workflows-v2/usecases/test-http-endpoint/test-http-endpoint.usecase.ts)

    • Wrapped compileControlValues in a try/catch that maps failures to BadRequestException with prefix HTTP request step template compilation failed: … so the dashboard test call gets 400, not 500.
    • compileControlValues now lets Liquid errors propagate and throws if JSON.parse fails on the rendered string (no more returning raw values).
  2. ExecuteHttpRequestStep (apps/worker/src/app/workflow/usecases/send-message/execute-http-request-step.usecase.ts)

    • Same compileControlValues behavior (throw on Liquid failure or invalid JSON after render).
    • execute catches that, writes CreateExecutionDetails with the compilation error message, returns SendMessageStatus.FAILED and respects continueOnFailure—same pattern as missing URL / SSRF / HTTP errors.

Git

  • Committed and pushed on cursor/sentry-error-investigation-05f2 (f5a59d0131).
  • PR fix(api-service,worker): fail HTTP step on invalid Liquid template compilation #10623 title was updated to: fix(api-service,worker): fail HTTP step on invalid Liquid template compilation.
  • The PR description could not be updated automatically (GitHub reports it is not agent-managed). You may want to edit the body manually to match the new behavior (fail fast, no silent fallback).

CI note

The bot still expects a Linear ticket in the title (fixes NOV-…) or in the branch name; add a ticket ID if you have one so pr-title-lint passes.

Open in Web Open in Cursor 

…mpilation

Remove silent fallback to uncompiled control values when Liquid parse/render
fails or JSON.parse of rendered output fails. API test endpoint returns 400;
worker records execution failure consistent with other HTTP step errors.

Co-authored-by: Dima Grossman <dima@grossman.io>
@cursor cursor bot changed the title fix(api-service,worker): catch LiquidJS TokenizationError in HTTP step template compilation fix(api-service,worker): fail HTTP step on invalid Liquid template compilation Apr 9, 2026
@scopsy scopsy requested a review from djabarovgeorge April 9, 2026 07:43
@scopsy scopsy marked this pull request as ready for review April 9, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants