Edge functions not forwarding requests for POST

I have an edge function that is modifying the request headers. Whenever I make a POST request to any of my API endpoints, the result is a gateway timeout error. The logs of the lambda function shows nothing as if it was never called. With GET method however, the edge function successfully calls my lambda and returns the response.

Either this is a bug or there is something that I am missing.

My site url is: coingen.netlify.app
An API call that can be tested: https://634a85e12b95fd07de7361b1--coingen.netlify.app/api/tickers

We’re sort of blocked because of this so any help would be greatly appreciated.

If I remove the edge function, then all of my endpoints start to work even with POST requests.

Hi @allroundexperts

Can you share the edge function code?


export default async (request: Request) => {
    console.log('Request found.');
        `Basic ${btoa(`${Deno.env.get('BASIC_AUTH_USERNAME')}:${Deno.env.get('BASIC_AUTH_PASSWORD')}`)}`

Hey @allroundexperts,

It appears this is happening when the request body is empty. I sent a JSON body as {} and that worked fine. Could you confirm?

That doesn’t seem to be the case for me @hrishikesh. Even with {} as body, it is still timing out. Check this URL for example:

I did test that, I also deployed a site myself and tested on that too. I get a response just fine. Here’s my curl if you wanna try:

curl --location --request POST 'https://634a839601ec290776f842fe--coingen.netlify.app/api/tickers' --header 'Content-Type: application/json' --data-raw '{}'

Here’s my Postman window too:

@hrishikesh Your curl request works for me as well. However, If I set the header Content-Length to 0 (which postman does automatically), the result is again a gateway timeout error.

I don’t think that’s true:


I get length as 2.

But, since you get this problem with content-length 0, I think we’ve confirmed that this open happens for POST requests with no body.

This has already been escalated to the devs, but I’m not sure if I understand the use case. Why would you want to send a empty body POST?

There’s no specific reason I can think of. Does the spec say not to use empty post?

According to this:

it does not. I was just wondering if you had a specific requirement for it.

Because, that would help us prioritize the issue. If your use case is to send POST with body and that doesn’t have this problem, we can work on this issue after taking care of more urgent issues.

If you had a use case in which an empty POST body is a hard requirement and you’re blocked because of this issue, it would have got a little more priority.

I would rank it as a mid priority. We’re not blocked but without this, the basic auth won’t really be active on our staging site.

Hi @allroundexperts :wave:t6:! Thank you for your feedback. We will follow up on this thread when we have next steps!

The issue has now been fixed. You can send POST with empty bodies and it would still work.