getsentry / getsentry/sentry-javascript

Local Variables not being reported when hosting on Vercel

Đang mở
#15,544 7 bình luận 1 reaction 0 người được giao Xem trên GitHub
Bug Node.js
Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.8k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
515

Mô tả

### Is there an existing issue for this?

- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

### 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

1. Create a NextJS project using [create-next-app](https://nextjs.org/docs/app/api-reference/cli/create-next-app): `npx create-next-app@latest temp-sentry-nextjs-localvars`
2. Install Sentry with the wizard: `npx @sentry/wizard@latest -i nextjs`
3. Add `includeLocalVariables: true` to `sentry.server.config.ts`
4. Implement a test function under `pages/api`, for example:
```js
const willThrow = () => {
const hey = 12
const value = 1
const str = "some string"
console.log(hey, value, str)
throw new Error("Intentional error on Sentry reproduction 3")
}

export default function handler(_req, res) {
try {
willThrow()
} catch (e) {
captureException(e)
}

res.status(200).json({ name: "John Doe" });
}
```
5. Upload the project to a git repo and deploy to [Vercel](https://vercel.com/)
6. 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.

![Image](https://github.com/user-attachments/assets/e2f211ee-3ab0-46d3-9d1d-9d9827668fab)

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

![Image](https://github.com/user-attachments/assets/19a98a89-b0ec-4854-a301-584dd320dd45)

Vercel apps are deployed on AWS Lambda, maybe the debugger used by Sentry to extract local variables doesn't work in that environment?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.