Task timed out after 10.01 seconds redirect

Hello.

I’ve got an error message for some of the pages

21-10-30

the project uses NextJS

  1. Is it possible to redirect users to some specific URL/page in such a case? (to avoid users seeing such messages)
  2. is it possible to increase the timeout

Thank you,
Best regards.

hi there maksym,
that’s the default timeout for our functions - we can bump it up to a maximum of 26 seconds for Pro customers, so if you’d like us to to that just let us know when you have upgraded to Pro tier.

hi.

what about the redirect?

is it possible to redirect users in such cases?

i suppose it would be possible if you wrote a custom function of some kind, but that isn’t something we have code for or can really help you with, i’m afraid.

thank you for your answers.

I have other questions then:

I use netlify-plugin-nextjs
and when you say:

does it mean that the only option I have is to stop using this plugin (because it is giving me very little control about the functions that I generate) and use something of my own?
or can I do it on netlify.toml/config or netlify-plugin-nextjs level?

another question is:
is it possible to see the logs which can tell me the cause problem?
does Netlify has such tracking of such issues?
where I can see the place where such errors happen.
and where I can see how often it happens (how many timeouts for some period of time).

Hello.

Any updates regarding my questions?
Can anybody help with that?

Another solution other than waiting for answers is to read the documentation and search for similar threads on the forums. But, here you go:

Logs are visible in your Site dashboard > Functions > Depending on which resource it is, it could be either of the three generated functions. You would have to add additional debug logs like console.time() to see what’s causing issues.

Not sure what you mean by that. The answer could be same as above, your function logs.

Again, in the function logs.

Same as above.

what a fresh idea. thank you, much appreciated.
sorry for bothering the support team regarding the support questions.

as you can see this block

it describes only 1 point, these questions are not separated, I just tried to make it clear as much as possible.

  1. Are you sure that these logs with console.time() can show a timeout error and the place/cause where it happened?
    BTW, it can show logs only for the last 7 days.

other than that, another solution you could advise is regarding the question that you entirely skipped:

  1. Do you have the answer in the documentation or at the forum for this specific case? Or your own answer? or at least a confirmation?

Best regards.

Just to be clear, I wasn’t mentioning about not asking us questions, I simply thought, instead of waiting and asking if there are some updates, you could probably find an answer faster if you search. But if you prefer waiting, it’s up to you. We’ll eventually get to your question too.

Not precisely. Here’s a better guide about console.time() than my explanations. In short, it would work like:

console.time('foo')
await doSomething()
console.timeEnd('foo')

The console should print something like:

foo: 5 s

Basically, you’d have to add the timers around your function calls and processes to see which one exactly took longer. So if your timer named task2 took 8 seconds but you expect it to take less, you know where to debug.

Isn’t that an acceptable time frame to debug the functions? We used to have those for 1 hour previously. 7 days seems like a big upgrade and should be enough to help you print and debug what’s happening with your functions. Happy to file a feature request to raise that limit even more, but it won’t be changing in the short term.

Having a custom plugin or function is not going to be a viable solution, in my opinion. You’d basically have to fork our plugin (or write your version from the scratch), make the necessary changes and use it. We won’t be able to provide support for that.

What you could do however is, you could add a setTimeout() function which would redirect you to some other page before the function times out. So if you’ve a time limit of 10 seconds, you can add the setTimeout() for 9 seconds. If the function completes without 9 seconds, you’d get your rendered output, if it takes more than 9 seconds, setTimeout() will fire and redirect it to somewhere else.