fix(nextjs): ignore response header mutations in GET handlers#209
fix(nextjs): ignore response header mutations in GET handlers#209aqilaziz wants to merge 1 commit into
Conversation
|
Note No issues found |
|
@aqilaziz is attempting to deploy a commit to the Million Team on Vercel. A member of the Team first needs to authorize it. |
9598ea1 to
1ed2336
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1ed2336. Configure here.
| } | ||
| if (object?.type !== "CallExpression" || object.callee?.type !== "Identifier") return false; | ||
| return object.callee.name === "headers"; | ||
| }; |
There was a problem hiding this comment.
Shared findSideEffect suppresses headers() detection across frameworks
Medium Severity
isHeadersFunctionMutationCall matches headers().set/append/delete(...) and silently suppresses it before the existing isCookiesOrHeadersCall(child, "headers") check can flag it. Since findSideEffect is shared with the TanStack Start rule (tanstack-start.ts line 562), this suppression also applies there — where headers() is not the Next.js read-only accessor and could be a user-defined function returning a mutable object. The headers() branch of isCookiesOrHeadersCall is now effectively dead code for all real Headers API methods. The function also has zero test coverage — the test fixture only exercises isHeadersApiMutationCall and isRequestScopedMutationCall.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 1ed2336. Configure here.


Summary
response.headers.set()in GET route side-effect detectionHeaders/Mapmutations created inside the handlerFixes #206.
Testing
pnpm exec vp test run tests/regressions/nextjs-side-effects.test.tspnpm exec tsc --noEmitfrompackages/react-doctorpnpm exec vp lintgit diff --check