fix(api-service,worker): fail HTTP step on invalid Liquid template compilation#10623
fix(api-service,worker): fail HTTP step on invalid Liquid template compilation#10623cursor[bot] wants to merge 2 commits intonextfrom
Conversation
…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>
✅ Deploy Preview for dashboard-v2-novu-staging ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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: Requirements:
Expected format: Details: PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name |
|
@cursoragent we should not fallback to the uncompiled version, if the compilation is broken we should throw an error |
|
Here is what I implemented in response to @scopsy’s review (“do not fallback; throw on broken compilation”). Changes
Git
CI noteThe bot still expects a Linear ticket in the title ( |
…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>


What changed
Wrapped
liquidEngine.parseAndRender()in a try-catch insidecompileControlValues()in both:TestHttpEndpointUsecase(apps/api/src/app/workflows-v2/usecases/test-http-endpoint/)ExecuteHttpRequestStep(apps/worker/src/app/workflow/usecases/send-message/)Why
Sentry Error: API-R0 —
TokenizationError: invalid value expression: "{subscriber.data.voice"When users write HTTP request step templates with invalid Liquid syntax (e.g., unclosed braces like
{subscriber.data.voiceinstead of{{subscriber.data.voice}}), LiquidJS throws aTokenizationErrorthat was previously unhandled. This caused a 500 Internal Server Error to bubble up to Sentry.The
JSON.parsefallback was already wrapped in try-catch, but theparseAndRendercall 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 existingJSON.parsefallback pattern and matches howtranslate.usecase.tshandles 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.parsecatch path. Users will see their literal template text rather than a 500 error.