NextJS 16 Support
Is this related to a new or existing framework?
Next.js
Is this related to a new or existing API?
No response
Is this related to another service?
No response
Describe the feature you'd like to request
Next.js 16 was just released. According to the amplify docs, next.js 16 is officially not supported. Seeing as a significant draw of Amplify is as an alternative hosting platform for next.js applications, and as our company is currently building an application on amplify / next.js, and seeing as next.js 16 offers significant ergonomic and performance improvements over next.js 15, I'd like to see official support for next.js ASAP. Failing that, I'd like to see a roadmap to supporting next.js 16.
Describe the solution you'd like
Official support for next.js 16.
Describe alternatives you've considered
N/A
Additional context
No response
Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change
Hey @lyleunderwood
Thanks for opening the issue. NextJS 16 is definitely on our radar. It has just been released at the beginning of the week.
We will have to check in depth where potential problems lie with NextJS 16 support.
I will mark it as a feature request and we'll come back to you as soon as we have results.
Cheers Philipp
Hey @lyleunderwood
Thanks for opening the issue. NextJS 16 is definitely on our radar. It has just been released at the beginning of the week.
We will have to check in depth where potential problems lie with NextJS 16 support.
I will mark it as a feature request and we'll come back to you as soon as we have results.
Cheers Philipp
Hi @bobbor , Nextjs 16 was in beta 9th Oct 2025 +2 weeks ago... after previous earlier releases.
Before it was beta I would have expected it would already be "on our radar", but since it became beta I would have expected someone on the Amplify team began to upgrade ready to support upon stable 16 (to be ready now).
We have a monorepo with 5 nextjs apps upgraded to 16 doing much faster builds, except the one that has Amplify which cannot be upgraded yet (and it only has Amplify because it is the only way to use rekognition liveness which is yet another 😬) 😬
hey @SuperManfred did you try an upgrade to see if anything goes poorly or were you just warded off by the dependency range warning on install? I'm running Next.js 16 and Amplify and things seem to be working for me fwiw.
@bobbor if nothing in the adapter cares about the fact that middleware has been renamed to proxy by Next.js team, then I doubt you'll have issues supporting it.
Yeah, so I did some checking and testing, and basically almost everything works fine.
Here are my results:
Overall
Next JS 16 support works in most use cases.
using webpack
When using webpack using the --webpack and or --no-turbopack flag, all is good.
no issues at all.
using turbopack
Amplify JS works. Amplify UI mostly too. The only exception is our @aws-amplify/ui-react-liveness package, when using turbopack.
What is the issue? the liveness package uses @tensorflow-models/face-detection for, well, face detection and that depends on @mediapipe/face_detection and the way the first imports the latter breaks in turbopack. I investigated why that would be the case and found out that it is fixable.
So what can be done about it? We have a couple of options here.
- we could create a PR and fix imports/exports for turbopack (and not break webpack ofc.)
- create a fork, apply the fix and use that instead.
- switch to an alternative face-detection library.
- officially not support
turbopackand leave everything as is.
All of these options have certain implications and we (as AmplifyJS team) will take some time, and think what is best for us and you.
TL;DR
we just need to bump the NextJS range in our packages and then we can officially support Next 16, if it wasn't for face-detection.
We'll keep you posted. Cheers Philipp
@bobbor did you happen to test the new cacheComponents functionality?
hey @lyleunderwood
I have only scanned over the topic and the docs say the following:
When the cacheComponents flag is enabled, Next.js uses React's <Activity> component to preserve component state during client-side navigation.
To me this indicates, that there should be no issue with enabling cacheComponents at all.
All base components have nearly no or very little state, and all connected components use <Provider />'s.
And since cacheComponents wraps components in an <Activity /> and that then just removes the component-output from the actual dom, but not the virtual one, it never unmounts them and all state should be preserved until "visible" again.
So, IMHO, AmplifyUI as well as AmplifyJS should work well out of the box. Though I cannot guarantee it, as I have not tested it.
Cheers Philipp
I have, since my last comment I actually just went through the process of migrating our app to next.js 16, turning on cacheComponents, etc., and deployed to Amplify. So far, no problems 👍
Thanks for your efforts @bobbor
Looking forward to support of @aws-amplify/adapter-nextjs as well :)
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/next
npm error next@"16.0.1" from the root project
npm error
npm error Could not resolve dependency:
npm error peer next@">=13.5.0 <16.0.0" from @aws-amplify/[email protected]
npm error node_modules/@aws-amplify/adapter-nextjs
npm error @aws-amplify/adapter-nextjs@"*" from the root project
By when can we expect Next16 to get supported ? When this issue we can close ?
@tmokmss @aj07 use your eyeballs and read the thread.
Hi @bobbor
I found this peculiar issue with NextJS 16 deployment on AWS Amplify. Sharing it here to see if you can point me in right direction of what are we doing incorrectly.
Error: ENOENT: no such file or directory,
copyfile '/codebuild/output/src285518752/src/next-demo/.next/server/proxy.js' -> '/codebuild/output/src285518752/src/next-demo/.next/standalone/.next/server/proxy.js'
at ignore-listed frames
{
errno: -2,
code: 'ENOENT',
syscall: 'copyfile',
path: '/codebuild/output/src285518752/src/next-demo/.next/server/proxy.js',
dest: '/codebuild/output/src285518752/src/next-demo/.next/standalone/.next/server/proxy.js'
}
What I found is that after running next build --webpack (also with turbopack), the .next/server directory has a middleware.js file instead of a proxy.js. I am not sure if this is a problem at NextJS end or at AWS Amplify end.
Please see. Thank you
With Regards Tushar S
hiya @tusharsrivastava
since there is no real code-sample available it's a bit of a wild guess and more like a shot in the dark. But let me have a try. Take this with a grain of salt, it's all just assumptions and guesses.
- the fact, that you get a
middleware.jsindicates to me that there is some pre Next16 processing happening. - all of our amplify libraries and published packages do not state compatibility with next 16. at least NOT YET. so every package that has remotely stated a dependency with next, will do so in the form of
<16.0.0
so to me it appears that you might have installed an Amplify package for example @aws-amplify/adapter-nextjs for SSR, which pulls next15 as a peer-/dev-/dependency.
to fix this you might want to pin the next version >=16.0.0 in your package.json [using resolutions (yarn) or overrides (pnpm/npm)]
It's just a hunch, but I hope this guides you into the right direction.
If you start investigating and notice bigger roadblocks or have more questions, please open a new ticket, so we can use that for fixing your issue and keep this ticket Next16 support focused.
Cheers Philipp
is anyone else getting these types of errors after upgrading to next.js 16:
Error: During prerendering, `cookies()` rejects when the prerender is complete. Typically these errors are handled by React but if you move `cookies()` to a different context by using `setTimeout`, `after`, or similar functions you may observe this error and you should handle it in that context. This occurred at route "/".
at new Promise (<anonymous>)
at AuthGetCurrentUserSessionServer (utils/amplify-utils.ts)
60 | export async function AuthGetCurrentUserSessionServer() {
61 | try {
> 62 | return await runWithAmplifyServerContextWithoutIdentityPool({
| ^
63 | nextServerContext: { cookies },
64 | operation: async (contextSpec) => {
65 | try { {
route: '/',
expression: '`cookies()`',
digest: 'HANGING_PROMISE_REJECTION'
}
it's not causing any harm from what I can tell and this is called within a suspense block.
hey @rei-shaholli
In version 15+ of NextJS cookies() returns a promise and is no longer synchronous.
so I would try to await the cookies()-function as we (as in Amplify) don't do this.
const cookieValue = await cookies();
return await runWithAmplifyServerContextWithoutIdentityPool({
...
nextServerContext: { cookies: cookieValue },
...
})
@bobbor thanks for the response! it does seem as though that the nextServerContext expects the "cookies" to be a function that returns a promise.
TS2322: Type ReadonlyRequestCookies is not assignable to type () => Promise<ReadonlyRequestCookies>
Type ReadonlyRequestCookies provides no match for the signature (): Promise<ReadonlyRequestCookies>
sorry @rei-shaholli, I think I misunderstood the issue. so, sorry for my misleading and (tbh) wrong answer.
after looking into your error-message in more detail, it seems that you are prerendering your application (either by configuration or due to NextJS update)
Error: During prerendering,
cookies()rejects when the prerender is complete.
this tells that during prerendering no request-context is available (request/response) and thus the cookies-promise will reject as there is nothing to read the Set-Cookie-header from.
I think you need to validate, either directly in AuthGetCurrentUserSessionServer or in the proxy-handler that a next.js request/response is available.
And your UI might need to incorporate <Suspense /> components for affected routes.
Alternatively you can also catch the rejected promise and return a "null-UserSession", which may have UI implications as well.
I'm not a Next-Expert, so I think this documentation explains the intricacies a bit better than me https://nextjs.org/docs/app/getting-started/cache-components#automatically-prerendered-content https://nextjs.org/docs/app/api-reference/functions/cookies
I hope this helps you more, and sorry again.
Cheers Philipp.
hey everyone.
I'd like to provide a small update.
Next16 compatibilty is almost finished. It consists of a bigger update on Amplify UI (https://github.com/aws-amplify/amplify-ui/pull/6744), and a small one for Amplify JS (https://github.com/aws-amplify/amplify-js/pull/14639)
Currently there is a final question to be clarified around licensing.
It originiates around the next.js dependency sharp. more details can be found here: https://github.com/lovell/sharp-libvips/issues/246
Once we have resolved it internally I will let you know when to expect official support for next.js.
Cheers Philipp
Hello @bobbor,
Thanks for the update. Just a small question: Is there any timeline on when we can expect to get Next 16 support?
Hello @Tajmirul , we don't have any update at the moment. We will provide an update on this issue once the Next 16 support is released.