I'm seeing `✘ TypeError: Illegal invocation: function called with incorrect `this` reference. See ht

I'm seeing ✘ TypeError: Illegal invocation: function called with incorrect this reference. See https://developers.cloudflare.com/workers/observability/errors/#illegal-invocation-errors for details. on

next@15.0.3
@cloudflare/next-on-pages@1.13.6
wrangler@3.91.0


seems to affect Next.js 15 App Router when using Route Handlers – will see if I can create a simple repro or it depends on any specifics of this small pet project. (I had it running with nodejs_compat_v1 so it might as well be that)

points to this https://github.com/vercel/next.js/blob/canary/packages/next/src/server/web/spec-extension/fetch-event.ts#L37-L49
likely introduced in https://github.com/vercel/next.js/pull/71309 which released in 15.0.0-canary => rc => stable

EDIT: yeah a fresh npm create cloudflare@latest -- my-next-app --framework=next and then running npx @next/codemod@canary upgrade latest shows the same error, filed https://github.com/cloudflare/next-on-pages/issues/912

EDIT 2: seems also related to vercel@39.1.2, forcing vercel@39.1.1 fixes it.
Was this page helpful?