Skip to content
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

When flagr encounters database errors during the GetFlag func it returns 404 #317

Closed
wildefires opened this issue Jan 29, 2020 · 0 comments · Fixed by #318
Closed

When flagr encounters database errors during the GetFlag func it returns 404 #317

wildefires opened this issue Jan 29, 2020 · 0 comments · Fixed by #318

Comments

@wildefires
Copy link

Expected Behavior

When database errors that aren't "row not found" errors, it should return a 5xx error

Current Behavior

Currently, in the case that the database is removed from behind a running instance of flagr (network connection, password change, etc) the application returns a 404 to a GET request on localhost:13480/api/v1/flags/1000

Possible Solution

Adjust the code to check for RecordNotFound errors and return 404s in that case; PR incoming

Steps to Reproduce (for bugs)

  1. Instantiate instance of flagr running against database (postgres, in my case)
  2. Remove the ability for flagr to connect to the database (stop the instance, change the user password, etc)
  3. do a GET on localhost:13480/api/v1/flags/1000 or any other flag
  4. Get a 404, even if the flag does exist (but is just inaccessible)

Context

Noticed this when loadtesting a cluster in AWS, that when the database would peak its CPU and requests to it timed out that the application would return 404s instead of 5xxs as expeted

Your Environment

  • Version used (flagr version): 1.15
  • Server type and version: aws/ECS Fargate
  • Operating System and version (uname -a):
  • Link to your project:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant