-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use Sentry NextJS integration with middleware on Cloudflare Pages #8935
Comments
Ok this is a bit hairy. All of our SDKs rely on some randomness mechanism to generate IDs for any events (errors, transactions, replays, profiles, ...). This is really at the core of the SDK and I don't think there currently is a way around this. But this sucks. I currently don't know what to do about this. I'll bring it to the team. |
We probably need to change |
You should note though that runtime still has the possibility to create uuids, just not outside the request context. I've tried to look for how to check the current context, but didn't find any solution for this besides using |
@blitss a fix for this was released in https://github.com/getsentry/sentry-javascript/releases/tag/7.69.0! |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/nextjs
SDK Version
7.66.0
Framework Version
7.66.0
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
Hi,
Probably this is not much of a Sentry issue, but popping this here in case you know any workaround for this, or maybe this can be fixed on your side.
Cloudflare workers runtime (not sure if any other serverless runtimes do though) has an issue with running Sentry Next.js integration along with middleware in a project. As the dev of next-on-pages said, the issue here is that Sentry causes "the generation of a
randomUUID
at the top level of the middleware function file."Issue on next-on-pages with explanation: cloudflare/next-on-pages#420 (comment)
So maybe Sentry can avoid calling
randomUUID
at the top level? I don't have much insight into Sentry internals or how Next.js integration works, or even why this doesn't work with middleware specifically but maybe you can shed some light on how this can be resolved.Repro (repo: Enalmada/next-apps-for-testing#1):
To run a Next.js project in Cloudflare worker env, you can do so locally:
Expected Result
Project works
Actual Result
The text was updated successfully, but these errors were encountered: