flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

Edge API requests return 502 in response to invalid JSON

Open rolodato opened this issue 1 year ago • 1 comments

How are you running Flagsmith

  • [ ] Self Hosted with Docker
  • [ ] Self Hosted with Kubernetes
  • [X] SaaS at flagsmith.com
  • [ ] Some other way (add details in description below)

Describe the bug

Requests to the Edge API with invalid JSON payloads return 502 instead of 400 like the Core API does. This can make it seem like a problem with our API when it's not.

Steps To Reproduce

POST invalid JSON to any Edge API endpoint, get 502 in response:

curl -i -X POST 'https://edge.api.flagsmith.com/api/v1/identities' -H 'Content-Type: application/json' -H 'X-Environment-Key: 123' -d '}{'

HTTP/2 502
server: awselb/2.0
date: Wed, 17 Apr 2024 14:42:10 GMT
content-type: text/html
content-length: 122

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>

Expected behavior

Any requests made with invalid JSON should return 400 and not 502.

Screenshots

No response

rolodato avatar Apr 17 '24 14:04 rolodato

may I be assigned this issue

RafaelJohn9 avatar May 03 '24 06:05 RafaelJohn9

This code isn't open source yet!

dabeeeenster avatar May 07 '24 09:05 dabeeeenster