3

I migrated one of my express app to firebase functions. Everything works perfectly except for DELETE requests that have a form body. When I access my function directly on this url

https://us-central1-[appname].cloudfunctions.net/app/api/hidden

and send a delete request with a form body everything works. But when I try this url

https://[appname].firebaseapp.com/api/hidden

which should behave the same way, I crash my app because body of the request is empty. For some reason I can't send a DELETE request with a body on the second url. Did anyone experience this issue?

My fireabse.json looks something like this

 {
  "hosting": {
    "rewrites":[{
        "source": "**",
        "function": "app"
    }]
  //other rules
  }
 }
abdu
  • 637
  • 5
  • 14

1 Answers1

0

I emailed firebase support and they replied with an answer. Basically delete requests are not supported for firebase apps. To quote:

...connecting Cloud Functions with Hosting is intended to serve dynamic content, that being said on your current implementation I would suggest to use the cloud functions URL only for the delete request (to preserve the caching advantages on other types of requests). Another option would be not to use the payload from the body since the HTTP 1.1 spec warns about using it “sending a payload body on a DELETE request might cause some existing implementations to reject the request”.

abdu
  • 637
  • 5
  • 14