-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): Instrument cache handler #13124
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
....com:getsentry/sentry-javascript into timfish/feat/nextjs-cache-handler-instrument
....com:getsentry/sentry-javascript into timfish/feat/nextjs-cache-handler-instrument
Ok, so a bit of an update of where I've got to...
I've got this PR working in a demo app via yarn link
:
...but in the e2e tests, import-in-the-middle
is getting bundled which stops it from working. I'm using the serverExternalPackages
config option (experimental.serverComponentsExternalPackages
in < Next v15) which should be able to add import-in-the-middle
to webpack externals but this doesn't appear to work in combination with pnpm when import-in-the-middle
is a sub-dependency:
I've opened an issue to include import-in-the-middle
in the next.js default server externals because it will never work when bundled but I kinda doubt this will actually fix the issue with pnpm 🤷♂️
@timfish is this still something you want to merge at some point, or can/should we close this?
Closing for now
Uh oh!
There was an error while loading. Please reload this page.
Closes #12888
The nextjs custom cache handler is loaded via dynamic import, therefore to wrap its exported class we use
import-in-the-middle
which is already a dependency of@sentry/node
.Since nextjs is CJS, you can use a sub-module path to instrument the default handler by adding it as a custom cache handler like this:
Needs tests!