Closed
Description
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
- other:
sentry/nextjs
Version:
6.17.4
Description
Any _middleware.ts
file inside the /pages/api
directory receives sentry-related code in the outputted file. This is not the case as soon as you move this _middleware.ts
file outside this api
directory.
As a result the function runtime throws an error because sentry tries to access the window
:
/Volumes/[...]/.next/server/pages/api/_middleware.js:6121
var manualScrollRestoration = true && 'scrollRestoration' in window.history && !!function() {
^
ReferenceError: window is not defined