We’re having an issue where function call is resulting in a 502 error, timeout after 10.01 seconds.
I get there is a 10s limit but my real question is I can’t figure out why it would ever take so long. In our dev environment, it takes a few ms. This is a complex endpoint with several postgresql queries and some mapping of data in javascript, but why the huge difference? I would have expected netlify CPUs and network connections to be way faster than my laptop (2017 intel MBP). Is that assumption wrong?
I also have seen that if we upgrade our account, we can also get the timeout upped to 26s, and we might do that, but I’d like to understand the underlying issues first.
The background API calls can go longer than 10s. You could try running there to log timing information. My guess is you’re making a call to a third party API, you don’t have a time limit for the call, and it’s never completing because of some bug somewhere, but that’s just an idle guess. You need to do some kind of logging to know why.
The only 3rd party service we’re accessing in this function is AWS RDS. Is it possible that queries we are doing locally, with the exact same data, take only 89ms but on Netlify take > 10s? I’m 99% sure nothing is throwing because we’d see that in the logs or in sentry. But yeah I can instrument this function more to see exactly how far it is getting and how long each step is taking.