You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a NextJS project using create-next-app: npx create-next-app@latest temp-sentry-nextjs-localvars
Install Sentry with the wizard: npx @sentry/wizard@latest -i nextjs
Add includeLocalVariables: true to sentry.server.config.ts
Implement a test function under pages/api, for example:
constwillThrow=()=>{consthey=12constvalue=1conststr="some string"console.log(hey,value,str)thrownewError("Intentional error on Sentry reproduction 3")}exportdefaultfunctionhandler(_req,res){try{willThrow()}catch(e){captureException(e)}res.status(200).json({name: "John Doe"});}
Upload the project to a git repo and deploy to Vercel
Add SENTRY_AUTH_TOKEN to the env variables in Vercel
Expected Result
When navigating to the test API route on the deployed app, an error should be reported to Sentry, containing all 3 local variables from the willThrow function.
Actual Result
No local variables appear in the Sentry issue when the app is deployed on Vercel.
However, running the same code locally npm run dev reports local variables to Sentry as expected.
If you set debug: true in your Sentry.init call in sentry.server.config.ts what gets logged out? You'll also have to set disableLogger: false in your next.config.js
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
9.2.0
Framework Version
Next 15.2.0
Link to Sentry event
https://aerial-ops.sentry.io/issues/6340230618/events/4b04a367762c4da59f3ffc5d112adccb/?project=6255059
Reproduction Example/SDK Setup
GitHub repo: https://github.com/cau777/temp-sentry-nextjs-localvars
Steps to Reproduce
npx create-next-app@latest temp-sentry-nextjs-localvars
npx @sentry/wizard@latest -i nextjs
includeLocalVariables: true
tosentry.server.config.ts
pages/api
, for example:SENTRY_AUTH_TOKEN
to the env variables in VercelExpected Result
When navigating to the test API route on the deployed app, an error should be reported to Sentry, containing all 3 local variables from the
willThrow
function.Actual Result
No local variables appear in the Sentry issue when the app is deployed on Vercel.
However, running the same code locally
npm run dev
reports local variables to Sentry as expected.https://aerial-ops.sentry.io/issues/6340144143/events/d4f46bc86efa400db9fac4c8c8f5e8c1/?project=6255059
Vercel apps are deployed on AWS Lambda, maybe the debugger used by Sentry to extract local variables doesn't work in that environment?
The text was updated successfully, but these errors were encountered: