-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Netlify dev server hangs if function returns 404 #695
Comments
I'm having the same problem. I have a function that I expect to return a 404 in certain cases, and if I send a request with postman, it hangs, and no response is returned. Any other statusCode resolves successfully without modifying any of the other code. If I then cancel the request in Postman, Looks like it's easily reproducible, but if more info is needed I can provide some, or try and set up a codesandbox to demo the issue. I hope this gets worked on! |
Actually, to provide an update, this only seems to be happen with nested functions (ie. functions inside subfolders within my functions directory). I copied the pattern implemented in the netlify workshop REST API example (with the API methods being called from a subfolder using a switch statement in a file in the root of the functions directory). When I return a 404 from the API method in the subfolder, the 404 seems to be returned, but then netlify starts looking for html files of the same name. Maybe this is a redirects issue? Here's a sample of a the logs from a request that returns a 404:
I did create a test function called |
I haven't been able to reproduce this while trying in both root functions directory and a subdirectory function. Could you please share a minimal reproducible example! |
Running into the same issue. Here is a minimal project demo with example e.g. |
Same issue here. |
I'm having the same exact issue. |
The same thing is happening to me. I'm POSTing data to a lambda and when it returns a 404, it hangs. I'm using Postman to hit the API. I'm not sure if it hands in the browser or not (I haven't gotten that far yet). |
This is awesome news. When will this fix hit npm? |
@donavon |
Thanks @terazus for reporting. This seems like a different issue from the one reported. Can you open a new one for it? |
Hi @erezrokah Let me kow if i need to open a new issue anyway :) |
Thanks for finding that! This looks like what you're experiencing. Going to cross link it |
This is a bug report.
Netlify dev server hangs when returning status code 404. This occurs when used with Eleventy dev server, though I am not sure if this is related.
I suspect this is somehow related to proxy behaviour - maybe there is some kind of conflict between servers handling 404.
Set up Elventy + Netlify dev as instructed here https://github.com/philhawksworth/eleventyone
Create a following function
bug404.js
(starts
eleventy serve
on the background)What is the expected behaviour?
The dev server returns the response immediately.
What is the actual behaviour?
The server never finishes processing the response and the curl waits out for it forever. You need to abort with CTRL+C.
The behaviour is the same under actual browsers. AJAX POST, e.g. initiated by jQuery, never returns when status code is set to 404.
However, if you change the status code e.g. to 403, or 200, it works:
curl call returns immediately.
Local Environment Information
The text was updated successfully, but these errors were encountered: