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

Nextjs ^13.4.0 500 errors #3466

Closed
5 tasks done
frattaro opened this issue May 6, 2023 · 31 comments
Closed
5 tasks done

Nextjs ^13.4.0 500 errors #3466

frattaro opened this issue May 6, 2023 · 31 comments
Labels
archived This issue has been locked. bug Something isn't working compute pending-verification-fix

Comments

@frattaro
Copy link

frattaro commented May 6, 2023

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

App Id

d3vbomo5vhow60

AWS Region

us-east-1

Amplify Hosting feature

Deployments

Describe the bug

Updating the nextjs dependency from 13.3.4 to 13.4.0 or 13.4.1 results in 500 error responses

Expected behavior

I'd expect amplify-hosted sites to function like it does with 13.3.4

Reproduction steps

  1. bump dependency
  2. wait for deployment
  3. see internal server errors

Build Settings

No response

Log output

# Put your logs below this line
  | 2023-05-06T09:45:35.938-04:00 | TypeError: handler is not a function
  | 2023-05-06T09:45:35.938-04:00 | at Server.<anonymous> (/tmp/app/server.js:29:11)
  | 2023-05-06T09:45:35.938-04:00 | at Server.emit (node:events:513:28)
  | 2023-05-06T09:45:35.938-04:00 | at parserOnIncoming (node:_http_server:998:12)
  | 2023-05-06T09:45:35.938-04:00 | at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)

Additional information

I see it failing for all 6 apps. Runs fine locally and in github actions.

@frattaro frattaro added bug Something isn't working pending-triage labels May 6, 2023
@iluvmemes
Copy link

I also am experiencing this with app id: d1ufjo04olhaov This is a first deployment of a fresh Nextjs 13.4.1 app.

@CarlosVF22
Copy link

I'm having the same problem too. With a fresh installation using Nextjs 13.4.1 and got error 500 from server.

@shawnseaton
Copy link

I am having the same error whether I use the pages router (supported by AWS Amplify) or App router (not supposed to be supported at this time by AWS Amplify) - TypeError: handler is not a function

2023-05-07T17:22:15.936-07:00 START RequestId: 81f2ee95-f6a5-404a-a48e-f09629d615bd Version: $LATEST

2023-05-07T17:22:15.937-07:00 [x-amplify-log][WARN] Skipping duplicate span name=RuntimeTotal

2023-05-07T17:22:15.937-07:00 [x-amplify-log][INFO] TRACING RequestId: 81f2ee95-f6a5-404a-a48e-f09629d615bd TraceId: Root=1-645840b7-70ab5d08110208c8005ad833

2023-05-07T17:22:15.937-07:00 [x-amplify-log][INFO] handling request host=127.0.0.1 port=3000 path_and_query=/ headers=x-forwarded-for: 174.72.31.68, 64.252.71.210, x-forwarded-proto: https, x-forwarded-port: 443, host: main.d3ugeayt2y6c7h.amplifyapp.com, x-amzn-trace-id: Root=1-645840b7-70ab5d08110208c8005ad833, user-agent: Amazon CloudFront, x-amz-cf-id: vHOkZ7XXtrKsT-CCBXyZFmsIa7kYfokuQ9hGGbiT6dhdyXKnvBXrdA==, accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7, via: redacted (64), accept-encoding: gzip, sec-ch-ua: redacted (66), sec-ch-ua-mobile: redacted (2), sec-ch-ua-platform: redacted (7), upgrade-insecure-requests: redacted (1), sec-fetch-site: redacted (10), sec-fetch-mode: redacted (8), sec-fetch-user: redacted (2), sec-fetch-dest: redacted (8), cloudfront-viewer-country: US

2023-05-07T17:22:15.996-07:00 TypeError: handler is not a function

2023-05-07T17:22:15.996-07:00 at Server. (/tmp/app/server.js:29:11)

2023-05-07T17:22:15.996-07:00 at Server.emit (node:events:513:28)

2023-05-07T17:22:15.996-07:00 at parserOnIncoming (node:_http_server:998:12)

2023-05-07T17:22:15.996-07:00 at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)

2023-05-07T17:22:16.000-07:00 [x-amplify-log][INFO] app response status_code=500 Internal Server Error headers=date: Mon, 08 May 2023 00:22:15 GMT, connection: keep-alive, keep-alive: redacted (9), content-length: 21, x-amplify-internal-request-id: 81f2ee95-f6a5-404a-a48e-f09629d615bd, x-amplify-internal-metrics: CustomerServerReadinessCheck;dur=177, RuntimeTotal;dur=258, RuntimeInitialization;dur=191, CustomerServerCall;dur=62

2023-05-07T17:22:16.016-07:00 REPORT RequestId: 81f2ee95-f6a5-404a-a48e-f09629d615bd Duration: 80.30 ms Billed Duration: 81 ms Memory Size: 1024 MB Max Memory Used: 74 MB In

@espenbye
Copy link

espenbye commented May 8, 2023

Got the same issue. Tried downgrading the Next.js packages, but it will still not work.

@abepuentes
Copy link

abepuentes commented May 8, 2023

I downgrading next because I was thinking this was related to next@13.4.1. So I went back to next@13.3.5 which was working before and I got the same results as @espenbye has already pointed out, internal error is present on next versions that were working just fine a couple of days ago. Seems like error is happening also on next@13.2 as you can find here #3467 and #3468.

@Lezzio
Copy link

Lezzio commented May 8, 2023

What's your package manager ? Using pnpm with symlinks broke our apps. We're now using another mode to avoid symlinks as a hot fix #3467

@espenbye
Copy link

espenbye commented May 8, 2023

Tried downgrading to 13.2.4 without luck - same issue. It was working on 13.3.4 before. Using NPM.

@frattaro
Copy link
Author

frattaro commented May 8, 2023

off topic:

IMO 13.2.4 was the last solid nextjs release, been buggy since then (talking about core nextjs, not including beta stuff like fonts, app dir, metadata, swc). I assume it's because of the edge stuff they're pushing.

@ghost
Copy link

ghost commented May 8, 2023

Hi folks, thanks for opening/engaging on this issue. We are currently working on root causing this behavior and determining next steps.

If you haven't already done so, please provide your App IDs so that we can investigate further. We will update this issue shortly. Thank you!

@espenbye
Copy link

espenbye commented May 8, 2023

Hi folks, thanks for opening/engaging on this issue. We are currently working on root causing this behavior and determining next steps.

If you haven't already done so, please provide your App IDs so that we can investigate further. We will update this issue shortly. Thank you!

🙌🏼

AppId: d3pgmzdoktuvon
Region: eu-north-1
Environment: develop

@ghost ghost added investigating and removed pending-triage labels May 8, 2023
@claptimes5
Copy link

Hi folks, thanks for opening/engaging on this issue. We are currently working on root causing this behavior and determining next steps.

If you haven't already done so, please provide your App IDs so that we can investigate further. We will update this issue shortly. Thank you!

drk0c55ymjt56

Thanks!

@ghost
Copy link

ghost commented May 8, 2023

👋🏽 Just giving an update here. We have reproduced this behavior with version 13.4.1. Downgrading to 13.2.4 mitigated the issue, but we see that did work for some folks though. We are continuing to root cause and determine mitigation steps.

@ghost
Copy link

ghost commented May 8, 2023

This issue is reproducible with Next.js versions 13.4.0 and 13.4.1. The latest release of Next.js where this issue does not occur is 13.3.4. If you haven't tried already, please downgrade to 13.3.4 or an early version of Next.js as a workaround.

@ghost
Copy link

ghost commented May 8, 2023

@abepuentes I see you tried to downgrade to 13.3.5, can you try version 13.3.4 instead?

@ghost
Copy link

ghost commented May 8, 2023

@espenbye you can try another method of downgrading. Please follow these steps to add a package version override to your Amplify application: https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html#setup-live-updates

Be sure to select Next.js version and set it to 13.3.4 or earlier.

@espenbye
Copy link

espenbye commented May 8, 2023

@espenbye you can try another method of downgrading. Please follow these steps to add a package version override to your Amplify application: https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html#setup-live-updates

Be sure to select Next.js version and set it to 13.3.4 or earlier.

Thanks! Will try that.

Also, I just downloaded the artifacts from the last build (where my package.json has next set to 13.2.4) and had a look at node_modules/next - package.json there still says 13.4.1 👀 Seems to be cached somewhere - is there a way to invalidate it?

@ghost
Copy link

ghost commented May 8, 2023

@espenbye I see. Try removing that path from your build settings:

  cache:
    paths:
      - node_modules/**/* <---- remove this line

@espenbye
Copy link

espenbye commented May 8, 2023

@hloriii Strange.. Tried both removing that and also specifying Next.js version under "Live package updates". Build artifact has the correct version in the root (./package.json), but in ./node_modules/next/package.json it is still 13.4.1

Edit: My bad. I thought I just could update the version number in package.json and run npm install. But that did not result in the correct version in package-lock.json. Pushed a new build now with the downgraded version, so hopefully that will fix it. 🤞🏼Thanks!

@espenbye
Copy link

espenbye commented May 8, 2023

Can confirm downgrading worked. 👍🏻 With npm i next@v13.2.3 instead of setting the version directly in package.json and then running npm install.

@shivpratik
Copy link

My last build with 13.3 worked perfectly fine. Now wth 13.4.1 it stopped working.

App ID: d3q4rozm6753hp
Region: us-east-2

By when will this issue be fixed?

@pldhiman
Copy link

pldhiman commented May 9, 2023

Same Issue, I have tried with 13.2.3, 13.2.4, 13.3.4 and 14.x.x

App ID: d3m86055xwbko8 // reproduced Internal Server Error continuously.

App ID: d3g1kvlu663ue6 // randomly occuring

This issue mainly occurs when deploying a new build. working perfectly fine on older deployed projects.

@abepuentes
Copy link

@abepuentes I see you tried to downgrade to 13.3.5, can you try version 13.3.4 instead?

@hloriii thanks for the info, 13.3.4 its working fine with some minor issues. About 13.4.1, could be this related? vercel/next.js#49536

@ferdingler
Copy link
Contributor

Hi, this issue is indeed related vercel/next.js#49536 . Looks like a regression was introduced on Next.js v13.4.0 on this commit: vercel/next.js@83b774e. We have submitted a PR with a recommended fix: vercel/next.js#49548.

@abepuentes
Copy link

abepuentes commented May 10, 2023

@ferdingler thanks for your comment and PR, let's hope some of the owners at next like @shuding could have some time to review it soon. Also seems like this vercel/next.js#49338 is related

@ErickPSDev
Copy link

Downgrade for me also works, I use "next": "^13.2.4".

I have had a talk with AWS support they say: Due to the Next latest version 13.4.X was just released 6 days ago, is facing some incompatibility issues, they don't have a date to solve this, so I chose to downgrade the NextJS version.

@frattaro
Copy link
Author

vercel/next.js#49548 is approved so it should likely come out in 13.4.2 (or 13.5.0, whatever it ends up being)

@abepuentes
Copy link

Hi everyone, next 13.4.2 canary 6 has the fix of this, thanks again to @ferdingler for his PR.

@frattaro
Copy link
Author

works! big thanks to the Amplify team, very impressive response

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the archived This issue has been locked. label May 12, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 12, 2023
@michrome
Copy link

Next.js 13.4.2 is now released and fixes this isssue. Thank you @ferdingler !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. bug Something isn't working compute pending-verification-fix
Projects
None yet
Development

No branches or pull requests