next-on-netlify function times out > 10s when deployed, renders in 0.3s locally
Asked Answered
A

1

9

Built with Next.js, next-on-netlify, and the page in question is using getServerSideProps.

Over an average of 10 page loads:

  • Using yarn dev (Next.js local dev), the full request takes ~1 second.
  • Using netlify dev, the full request takes < 1 second.
  • Using the Netlify function on Lambda, the full request takes ~9.5 seconds, and times out above 10 frequently.

I’ve profiled the time from the getServerSideProps call to the return of the page function, and on all environments, that reliably takes < 1 second.

I’ve also tried removing all content from the page and requests from the props, and neither has any affect on the Netlify function.

How can I profile where the bottle neck is? Is this potentially a Netlify issue?

Ante answered 10/12, 2020 at 22:8 Comment(6)
Hi, if you solved this issue, please let me know how you solved it, as I am facing the same issue.Oribel
Nope, sorry. This issue went unresolved and caused us to move to Vercel.Ante
I have the exact same problem, also no problems on local and after deploying it to netlify, 10s timeouts. But with connecting to a database (prisma postgres) via graphql and nexus, using the nexus-plugin-prisma.Disappear
Did u find a solution with Netlify, anybody?Disappear
I started to receive this error (but not always) after adding some frontend libs (Material UI 5 + Emotion). Looks like the API call is not the only thing that matters for getting timeouts.Astrionics
I am using multiple libraries and facing the same issue, moving to VercelYuonneyup
B
0

Perhaps try moving to the https://gallery.ecr.aws/lambda/nodejs container for both local and deployed (to both lambda and ECR). This could help you narrow down if the fault is in the aws lambda runtime, or something related to being deployed to AWS.

Blocked answered 22/3, 2024 at 15:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.