Repository navigation
fix(functions): ignore a second argument to res.json, as deployed functions do - #312
Merged
Merged
Conversation
…ctions do Deployed functions (lambda-node-bridge and Vercel's @vercel/node) define res.json with one argument and keep the current status. Express 4 still honours its deprecated res.json(status, body) and res.json(body, status) forms, so serve answered 404 or 500 where a deployed function answers 200. Pass only the first argument on, and record it in the approved V1 differences.
…AGENTS.md Test code and prose; no credentials.
Test code; no credentials.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
dhruv-parekh-cs
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Deployed AWS functions (
lambda-node-bridge/cf-sv-with-helpers.ts) and Vercel's@vercel/nodedefineres.json = (jsonBody) => json(req, res, jsonBody): one argument,JSON.stringify,application/json; charset=utf-8unless a content type is already set, current status kept. Locally,launch:functions:serveuses Express 4'sres.json, which still honours the deprecated two-argument forms and sets the status from them.res.json(404, { error: 'missing' })404{"error":"missing"}res.json({ ok: false }, 500){"ok":false}res.status(201).json({ id: 'a1' })res.type('text/plain').json({ a: 1 })text/plainkeptFound in the review of gap 3 (#311), which made
res.sendone-argument the same way. Added to CL-8970 as gap 12, agreed with Dhruv.The change
src/functions/cloud-functions.ts: in the existingsendLikeDeployedFunctionsmiddleware,res.jsonnow passes only its first argument on to Express'sjson.AGENTS.md: the approved V1 differences note thatres.jsontakes one argument too, and that Azure/GCP (V1, Express 4) still honour the two-argument forms ofres.sendandres.json..talismanrc: refreshed checksums forcloud-functions.test.tsandAGENTS.md(test code and prose, no credentials).Tests
src/functions/cloud-functions.test.ts: one regression test (ignores a second argument to res.json and keeps the current status, as deployed functions do). It failed before the fix with Express's 404, and it also asserts a status set withres.status()and a content type already set are kept.application/jsoncontent type, turns the test red.E2E (http-sanity cloud-functions checks, AWS expectations)
v2-dev 3604ddc: 8/15; this branch: 8/15, no check changed. None of the 15 checks covers the two-argument
res.jsonform yet; adding one needs an e2e PR incontentfly-e2e-testsbehindLAUNCH_E2E_CLOUD_FUNCTION_PARITY, with Azure/GCPknownGaps(Express's status).Notes
--no-verify. The pre-push trufflehog step scanned 0 chunks in this shallow clone, so trufflehog was run by hand on the 4 changed files: 0 secrets.QA: the Launch QA agent tests CL-8970 in the repos once it is in QA; GoCD sanity covers dev11.
Jira: https://contentstack.atlassian.net/browse/CL-8970