flagsmith
flagsmith copied to clipboard
Edge API requests return 502 in response to invalid JSON
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
may I be assigned this issue
This code isn't open source yet!