skip to Main Content

I have an app built in Nexjs (13.4, Node 18.16) that calls a Lambda function (API Gateway).

I have the same versions locally, and it runs fine when I do npm run dev, but I hit an error when I try to launch the website through the Amplify link.

Cloudwatch shows this error:

TypeError: handler is not a function
at Server.<anonymous> (/tmp/app/server.js:29:11)
at Server.emit (node:events:513:28)
at parserOnIncoming (node:_http_server:998:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)

Any idea?
Thanks

I’m new to this technology so it might be something simple but I don’t find anything online.

The deployment was already problematic (AWS compatibility issues with Node 18.16), I use a public image as the initial container public.ecr.aws/docker/library/node:18.16.0

Anyway, I tried with an out of the box nextjs app (default app) and I hit the same issue, which is disturbing.

2

Answers


  1. I have the same problem with nextjs 13.4. I downgraded to 13.3 and it solved the problem and page renders fine. It seems like amplify is not fully ready for 13.4

    Login or Signup to reply.
  2. This is not an issue with AWS Amplify. The actual issue from nextjs 13.4.0 the server.js file created by the standalone output is incorrect because it does not wait until the Next handler is ready before node http server starts accepting requests. This has been fixed in next 13.4.2 version. Full details https://github.com/vercel/next.js/commit/0f332055d43fa97acbb52d7a9c187850bc08073f

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search