Error: 502: {"errorMessage": " Task timed out after 10.01 seconds"} nextJS

Hello,

I have website with backend of Strapi CMS on heroku, and NextJS frontend on Netlify.
I don’t know why sometimes while navigating to other pages,
the website gives this error of 502
{“errorMessage”:“2021-02-28T07:01:23.806Z 4234f202-e15d-4a25-84ce-79b9c82ac634 Task timed out after 10.01 seconds”}

Is there any way to fix this??

Thanks in advance,

Judy

1 Like

Maybe you’re running a function or something which has a 10 sec timeout.

Yes, it is running a function. How can I solve this error ? …it seems from the server

You can’t solve it per se. Functions are limited to 10 seconds execution time and that limit is applied by AWS. You need to find a way to reduce the time required by the function, or switch to Background Functions or skip using Functions altogether.

1 Like

is there any way if I upgrade the plan, would solve the problem??

Please, if anyone can help me find any way to solve this.

No, as I said, the limit is applied by AWS and not Netlify as far as I know. It’s the same for all plans I suppose. The only way out is background functions which can run for 15 mins.

UPDATE: I just checked the forums and you can get the timeout to upto 26 seconds I suppose: Changing region and increasing timeout seconds for netlify functions - #2 by Pie. Would that be enough for your case?

:point_up: is correct :smiley:

Pro (and above) users can request support to increase their Lambda invocation timeout to up to 26 seconds. Do let us know if your team meets this requirement and we’d be happy to increase this for you.

You guys are not helping.

Why is there an error like this every time I deploy my Nextjs project?

Hey there, @tia :wave:

It looks like you have opened two threads here. We ask that folks keep all related questions in one thread so that we can help you as quickly as possible. I am going to close this current one so that we can continue below: