Package + Version
Version:
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