-
-
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
Issues running @vercel/og when @sentry/nextjs is installed #5964
Comments
Are you using Vercel's edge runtime? If yes, the Sentry SDK doesn't currently support it. Can you try the same thing using ordinary Node.js as a runtime? Thanks! |
@lforst the package mentioned above only works on the edge runtime. I initially hoped to turn it off for just one route, but it seems like the only way I could get any of this to work was by completely uninstalling the package. I'll get a test repo up for you. |
I have been having issues replicating this with a new repo. https://github.com/jcblw/sentry-vercel-og-issue It seems like, for some reason, on my private repo, Sentry thinks the Image responses are React components, so the client performance library runs. Going to close for now until I can get that repo to throw the error. |
Reproduction: https://github.com/nathanhammond/turbo/tree/open-graph-image Create a Vercel project for the
It appears to be inserting instrumentation for Further notes: |
This means I can't work around it with any other method except by toggling
|
Going to reopen with @nathanhammond comments. |
We're working on an option to turn off auto-instrumentation for individual API routes. Support for the Edge runtime currently isn't planned any time soon. For now, to get this working, you can set |
Currently, in the nextjs SDK, we inject the user's `Sentry.init()` code (by way of their `sentry.server.config.js` file) into all serverside routes. This adds a new option to the `sentry` object in `next.config.js` which allows users to prevent specific routes from being instrumented in this way. In this option, excluded routes can be specified using either strings (which need to exactly match the route) or regexes. Note: Heavily inspired by #6125. h/t to @lforst for his work there. Compared to that PR, this one allows non-API routes to be excluded and allows excluded pages to be specified as routes rather than filepaths. (Using routes a) obviates the need for users to add `pages/` to the beginning of every entry, b) abstracts away the differences between windows and POSIX paths, and c) futureproofs users' config values against underlying changes to project file organization.) Docs for this feature are being added in getsentry/sentry-docs#5789. Fixes #6119. Fixes #5964.
This should be released as part of 7.20 later this week. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.15.0
Framework Version
7.15.0
Link to Sentry event
No response
Steps to Reproduce
yarn dev
Expected Result
I should be able to use @sentry/nextjs and @vercel/og in the same project. The only way I could get images generated on Vercel was to remove the integration altogether.
Actual Result
I run into initial issues with auto instrumentation due to the config exports. If I remove the export, it no longer throws a Sentry issue but another error due to missing dependencies on the edge function. Here is that original error.
The error on Vercel after turning off auto instrumentation.
/api/sponsor
is the route of the image. I think Sentry assumes this is a client view since it's using browser tracing and attempting to accessdocument.getElementById
. Also, this file extension is a TSX fileThanks, and let me know if I am just misconfiguring this!
The text was updated successfully, but these errors were encountered: