[!NOTE]
Disclaimer: although I recognize it might be too early to think about Next.js 15 support, but it might be beneficial. I suggest at least to consider it.
Although OpenNext works fine with next@rc, it doesn't work with latest Next.js 15 canary (which eventually be a new RC). Issue is related to incremenatal cache changes. Specifically: kind values before were FETCH, IMAGE, REDIRECT, ROUTE, PAGE, but now values are FETCH, IMAGE, REDIRECT, APP_PAGE, APP_ROUTE, PAGES.
I confirmed that latest OpenNext (3.1.1) doesn't work with Next.js 15.0.0-canary.145. While it can be successfully deployed, when you try to open deployed application server function will fail with the following stack trace:
⨯ TypeError: result.toUnchunkedString is not a function
at sendRenderResult (/var/task/node_modules/.pnpm/next@15.0.0-canary.145_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-a03254bc-20240905_react@1_675uctallwwvzvgc2kh2q6726i/node_modules/next/dist/server/send-payload.js:64:54)
at NextNodeServer.sendRenderResult (/var/task/node_modules/.pnpm/next@15.0.0-canary.145_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-a03254bc-20240905_react@1_675uctallwwvzvgc2kh2q6726i/node_modules/next/dist/server/next-server.js:573:50)
at NextNodeServer.pipeImpl (/var/task/node_modules/.pnpm/next@15.0.0-canary.145_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-a03254bc-20240905_react@1_675uctallwwvzvgc2kh2q6726i/node_modules/next/dist/server/base-server.js:972:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async NextNodeServer.handleCatchallRenderRequest (/var/task/node_modules/.pnpm/next@15.0.0-canary.145_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-a03254bc-20240905_react@1_675uctallwwvzvgc2kh2q6726i/node_modules/next/dist/server/next-server.js:283:17)
at async NextNodeServer.runImpl (/var/task/node_modules/.pnpm/next@15.0.0-canary.145_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-a03254bc-20240905_react@1_675uctallwwvzvgc2kh2q6726i/node_modules/next/dist/server/base-server.js:942:9)
at async NextNodeServer.handleRequestImpl (/var/task/node_modules/.pnpm/next@15.0.0-canary.145_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-a03254bc-20240905_react@1_675uctallwwvzvgc2kh2q6726i/node_modules/next/dist/server/base-server.js:876:20)
at async jX (file:///var/task/modules/frontend/index.mjs:58:239839)
at async file:///var/task/modules/frontend/index.mjs:58:239536
at async Wk (file:///var/task/modules/frontend/index.mjs:58:239430)
Although OpenNext works fine with
next@rc
, it doesn't work with latest Next.js 15 canary (which eventually be a new RC). Issue is related to incremenatal cache changes. Specifically:kind
values before wereFETCH
,IMAGE
,REDIRECT
,ROUTE
,PAGE
, but now values areFETCH
,IMAGE
,REDIRECT
,APP_PAGE
,APP_ROUTE
,PAGES
.Next.js 14.2.8 implementation: https://github.com/vercel/next.js/blob/v14.2.8/packages/next/src/server/response-cache/types.ts#L92-L97 Next.js 15.0.0-rc.0 implementation (same as 14.2.8): https://github.com/vercel/next.js/blob/v15.0.0-rc.0/packages/next/src/server/response-cache/types.ts#L92-L97 Next.js 15.0.0-canary.145 implementation: https://github.com/vercel/next.js/blob/v15.0.0-canary.145/packages/next/src/server/response-cache/types.ts#L141-L147
Note: new
APP_PAGE
kind also has different object structure: https://github.com/vercel/next.js/blob/v15.0.0-canary.145/packages/next/src/server/response-cache/types.ts#L110-L119I tracked down these changes to this commit: https://github.com/vercel/next.js/commit/e456acd85462bcf1807f6662f21ee16cedb2409d. It was released in
15.0.0-canary.13
.My understanding is that changes should be done here: https://github.com/sst/open-next/blob/main/packages/open-next/src/adapters/cache.ts
I confirmed that latest OpenNext (3.1.1) doesn't work with Next.js 15.0.0-canary.145. While it can be successfully deployed, when you try to open deployed application server function will fail with the following stack trace: