Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Route Handlers after Upgrading to Next.js 14 #99

Open
gallirohik opened this issue Aug 29, 2024 · 1 comment
Open

Issue with Route Handlers after Upgrading to Next.js 14 #99

gallirohik opened this issue Aug 29, 2024 · 1 comment

Comments

@gallirohik
Copy link

Hi Team,

We’ve been successfully using sladg/nextjs-lambda for building our pages router, and it has been working as expected.

Recently, we upgraded to Next.js 14 and started implementing the app router. While we were able to render server components without any issues, we encountered a problem with the route handlers. Specifically, we are receiving a 502 response when trying to access them.

Static assets are deployed into s3, server.js is on lamda function.

Note : we are using cloudfront to as an origin.
File structure :

Screenshot 2024-08-29 at 12 53 27 PM

Below is our build configuration for your reference:

build.sh

set -x
# caching optimizations
npm config -g set prefer-offline true
# ci
npm ci
# build
npm run build
# move any generated public/*.* resources into Lambda
mkdir .next/standalone/public
mkdir .next/standalone/.next/static
cp -R public/. .next/standalone/public
cp -R .next/static/. .next/standalone/.next/static
# pack
npx --package @sladg/nextjs-lambda cli pack```


@sladg
Copy link
Owner

sladg commented Oct 6, 2024

Hey! v14 of Next is not supported unfornatelly. Moreover, with #97, I do not plan to fix it.
I would encourage you to switch to OpenNext or https://github.com/awslabs/aws-lambda-web-adapter (you can also check out https://github.com/sladg/lambda-server-adapter/blob/master/examples/Next.md for minimalistic and probably more universal PoC I did on this topic)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants