I recently created a new Eleventy site that has one serverless function that is used to search Algolia. The function works as expected locally but never when it is deployed to Netlify.
I have an ongoing GitHub discussion about this on the 11ty repo if you’re interested. None of the suggested fixes have worked so far. That discussion provides a lot of other links and information that might prove useful.
I have tried to debug the issue by using the Netlify CLI locally, but the function works then. I have also tried logging out as much info as possible to see where the issue might lie. I just don’t know what it could be.
I am on the Netlify free tier, but I’m pretty sure my function shouldn’t be going over the limits required for the free tier, however I might be wrong in that fact…
An unhandled error in the function code triggered the following message:
2023-02-03T07:06:57.880Z f99e9ced-3ac5-4e15-8130-a8db497a342b Task timed out after 10.01 seconds
### Connection details
Netlify internal ID: `01GRB1JQEZ63D2KZHWKD2YC6T4`
Please let me know if you require more information.
I’m not sure how exactly we can help here. To me, it looks like a Function timeout issue, but since it’s not a Function you or me have developed, I’m not sure what steps we can take to troubleshoot this.
Are there any logs on your side that might give some more insight into the issue?
No, the only function logs that are available are visible in the function logs.
Also, I tried replaced all the logic for searching Algolia a with static data and still had the same issue.
I have also deployed another demo project to test if it was my account that somehow had an issue, but it worked so that’s not the issue.
I’m sure it’s something that can easily be fixed, I just can’t figure it out.
Ah ok. That’s a shame because they really don’t reveal much.
Logging in functions is a developer’s task. If you need more logs, you need to log the data yourself. The reason I said we cannot debug much is because it appears you’re not creating the function yourself. If you’re, please add some logs like
console.time() to figure out where the process hangs.
They don’t have any at the moment but I have tried with a lot of logging and the log content never changes. See this commit for an example: add serverless logs · mrmartineau/11ty-notes@49d29db · GitHub
I don’t think that part from the code gets deployed as a Netlify Function. Does it?
Ah that’s interesting. That code is run whenever my function is run… I will look into another debugging method in that case, I think I might have an idea. Thanks