Multiple retry on Serverless Lambda Functions with 404 statusCode

When I return a statusCode of 404 with a serverless function I see the system retry and call again the functions 4 times.

For example if this URL return a 404

http://localhost:8888/.netlify/functions/getproduct/57498375

In the logs I see the function has been called 4 times

http://localhost:8888/.netlify/functions/getproduct/57498375.htm
http://localhost:8888/.netlify/functions/getproduct/57498375.html
http://localhost:8888/.netlify/functions/getproduct/57498375/index.html
http://localhost:8888/.netlify/functions/getproduct/57498375/index.htm

At first, I thought it was the browser, but then I saw that all the browsers have the same behaviour.
I cannot find anything in the Netlify documentation nor the AWS Lambda Functions docs.

Does somebody know who is responsible for these calls? And also know how to stop them?

No one, as in no person, is responsible for the calls. They are from the alternativePathsFor function in @netlify/cli/src/utils/proxy.js

I don’t believe you can.

Aahah, sorry I meant what system is responsible - browser, lambda functions, netrlify dev, …

That is a shame.

Unsure why you (apparently) find this such an issue.

For debugging purpose I would like to have only one answer instead of 4.
Plus, in my opinion, it should be customizable: I should decide which are the alternativePaths of my API.

1 Like