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

[BUG] POST to /login route causes 500 error #118

Closed
alexjball opened this issue Aug 21, 2021 · 1 comment · Fixed by #119
Closed

[BUG] POST to /login route causes 500 error #118

alexjball opened this issue Aug 21, 2021 · 1 comment · Fixed by #119

Comments

@alexjball
Copy link
Member

alexjball commented Aug 21, 2021

Describe the bug
Calling the /login route on the production flask app using docker-compose causes a 500 error with these error logs:

api_1  | [2021-08-21 15:59:03 +0000] [9] [DEBUG] POST /api/v1/auth/login  
api_1  | [2021-08-21 15:59:03,488] ERROR in app: Exception on /api/v1/auth
/login [POST]                                                             
api_1  | Traceback (most recent call last):                               
api_1  |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/_c
ollections.py", line 1020, in __call__                                    
api_1  |     return self.registry[key]                                    
api_1  | KeyError: 140032363771712                                        
api_1  |                                                                  
api_1  | During handling of the above exception, another exception occurre
d:                                                                        

api_1  |   File "/usr/local/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 933, in apply_driver_hacks
api_1  |     if sa_url.drivername.startswith('mysql'):
api_1  | AttributeError: 'NoneType' object has no attribute 'drivername'

To Reproduce
Steps to reproduce the behavior:

  1. Start system with docker-compose up -d
  2. Post to login route (inside or outside the api container)
curl -X POST -d '{"email": "[email protected]", "password": "password"}' -H 'Content-Type: application/json' localhost:5000/api/v1/auth/login

Calling the / route works, as does calling these routes with the test client.

Expected behavior
4XX error since the user doesn't exist

@alexjball
Copy link
Member Author

SQLALCHEMY_DATABASE_URI was not being set in the config. The production app pulls from a different env variable. Switching to the dev environment fixes the issue. Will update the compose file to run the flask app in dev mode

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