full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

"GET /api/v1/users/me HTTP/1.1" get a 500 response

Open yanrongkun opened this issue 3 years ago • 0 comments

I just deployed the project on my ubuntu. login by "POST /api/v1/login/access-token HTTP/1.1" are fine but "GET /api/v1/users/me HTTP/1.1" get a 500 response. does anyone has the same problem?

backend_1 | INFO: 172.18.0.6:49658 - "POST /api/v1/login/access-token HTTP/1.1" 200 OK backend_1 | INFO: 172.18.0.6:49658 - "GET /api/v1/users/me HTTP/1.1" 500 Internal Server Error backend_1 | ERROR: Exception in ASGI application backend_1 | Traceback (most recent call last): backend_1 | File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi backend_1 | result = await app(self.scope, self.receive, self.send) backend_1 | File "/usr/local/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in call backend_1 | return await self.app(scope, receive, send) backend_1 | File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 149, in call backend_1 | await super().call(scope, receive, send) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 102, in call backend_1 | await self.middleware_stack(scope, receive, send) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 181, in call backend_1 | raise exc from None backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in call backend_1 | await self.app(scope, receive, _send) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 76, in call backend_1 | await self.app(scope, receive, send) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 82, in call backend_1 | raise exc from None backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in call backend_1 | await self.app(scope, receive, sender) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 550, in call backend_1 | await route.handle(scope, receive, send) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 227, in handle backend_1 | await self.app(scope, receive, send) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 41, in app backend_1 | response = await func(request) backend_1 | File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 190, in app backend_1 | dependency_overrides_provider=dependency_overrides_provider, backend_1 | File "/usr/local/lib/python3.7/site-packages/fastapi/dependencies/utils.py", line 479, in solve_dependencies backend_1 | dependency_cache=dependency_cache, backend_1 | File "/usr/local/lib/python3.7/site-packages/fastapi/dependencies/utils.py", line 510, in solve_dependencies backend_1 | solved = await run_in_threadpool(call, **sub_values) backend_1 | File "/usr/local/lib/python3.7/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool backend_1 | return await loop.run_in_executor(None, func, *args) backend_1 | File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run backend_1 | result = self.fn(*self.args, **self.kwargs) backend_1 | File "./app/api/deps.py", line 32, in get_current_user backend_1 | token, settings.SECRET_KEY, algorithms=[security.ALGORITHM] backend_1 | File "/usr/local/lib/python3.7/site-packages/jose/jwt.py", line 154, in decode backend_1 | payload = jws.verify(token, key, algorithms, verify=verify_signature) backend_1 | File "/usr/local/lib/python3.7/site-packages/jose/jws.py", line 80, in verify backend_1 | _verify_signature(signing_input, header, signature, key, algorithms) backend_1 | File "/usr/local/lib/python3.7/site-packages/jose/jws.py", line 266, in _verify_signature backend_1 | keys = _get_keys(key) backend_1 | File "/usr/local/lib/python3.7/site-packages/jose/jws.py", line 233, in _get_keys backend_1 | if 'keys' in key: backend_1 | TypeError: argument of type 'int' is not iterable

yanrongkun avatar Jan 18 '22 13:01 yanrongkun