supertokens-python icon indicating copy to clipboard operation
supertokens-python copied to clipboard

python sdk delete_user throwing general error with no method

Open EricChristensen opened this issue 1 year ago • 4 comments

We are using the python sdk at version 0.17.0 using python version 3.11 from the public.ecr.aws/lambda/python:3.11 and running the backend SDK via a Lambda and API Gateway integration using the magnum and uvicorn.

The error logs that we are receiving when trying to call this method is:

2024-05-15T17:19:20.330Z	[ERROR] 2024-05-15T17:19:20.323Z f98ca373-f523-4419-99e3-bd59e888b49d An error occurred running the application.
2024-05-15T17:19:20.330Z	Traceback (most recent call last):
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/mangum/protocols/http.py", line 58, in run
2024-05-15T17:19:20.330Z	await app(self.scope, self.receive, self.send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in __call__
2024-05-15T17:19:20.330Z	await self.app(scope, receive, send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/fastapi/applications.py", line 1106, in __call__
2024-05-15T17:19:20.330Z	await super().__call__(scope, receive, send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
2024-05-15T17:19:20.330Z	await self.middleware_stack(scope, receive, send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
2024-05-15T17:19:20.330Z	raise exc
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
2024-05-15T17:19:20.330Z	await self.app(scope, receive, _send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/base.py", line 108, in __call__
2024-05-15T17:19:20.330Z	response = await self.dispatch_func(request, call_next)
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/task/member/member.py", line 283, in dispatch
2024-05-15T17:19:20.330Z	response = await call_next(request)
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/base.py", line 84, in call_next
2024-05-15T17:19:20.330Z	raise app_exc
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/base.py", line 70, in coro
2024-05-15T17:19:20.330Z	await self.app(scope, receive_or_disconnect, send_no_error)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/base.py", line 108, in __call__
2024-05-15T17:19:20.330Z	response = await self.dispatch_func(request, call_next)
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/framework/fastapi/fastapi_middleware.py", line 66, in dispatch
2024-05-15T17:19:20.330Z	result: Union[BaseResponse, None] = await st.handle_supertokens_error(
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/supertokens.py", line 666, in handle_supertokens_error
2024-05-15T17:19:20.330Z	raise err
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/framework/fastapi/fastapi_middleware.py", line 53, in dispatch
2024-05-15T17:19:20.330Z	response = await call_next(request)
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/base.py", line 84, in call_next
2024-05-15T17:19:20.330Z	raise app_exc
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/base.py", line 70, in coro
2024-05-15T17:19:20.330Z	await self.app(scope, receive_or_disconnect, send_no_error)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
2024-05-15T17:19:20.330Z	raise exc
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
2024-05-15T17:19:20.330Z	await self.app(scope, receive, sender)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
2024-05-15T17:19:20.330Z	raise e
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
2024-05-15T17:19:20.330Z	await self.app(scope, receive, send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
2024-05-15T17:19:20.330Z	await route.handle(scope, receive, send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
2024-05-15T17:19:20.330Z	await self.app(scope, receive, send)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
2024-05-15T17:19:20.330Z	response = await func(request)
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/fastapi/routing.py", line 274, in app
2024-05-15T17:19:20.330Z	raw_response = await run_endpoint_function(
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
2024-05-15T17:19:20.330Z	return await dependant.call(**values)
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/task/member/member.py", line 109, in delete_user_
2024-05-15T17:19:20.330Z	await delete_user(user_id.user_uid)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/asyncio/__init__.py", line 81, in delete_user
2024-05-15T17:19:20.330Z	return await Supertokens.get_instance().delete_user(user_id, user_context)
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/supertokens.py", line 359, in delete_user
2024-05-15T17:19:20.330Z	await querier.send_post_request(
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/querier.py", line 275, in send_post_request
2024-05-15T17:19:20.330Z	return await self.__send_request_helper(path, "POST", f, len(self.__hosts))
2024-05-15T17:19:20.330Z	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/querier.py", line 436, in __send_request_helper
2024-05-15T17:19:20.330Z	raise_general_exception(e)
2024-05-15T17:19:20.330Z	File "/var/lang/lib/python3.11/site-packages/supertokens_python/exceptions.py", line 25, in raise_general_exception
2024-05-15T17:19:20.330Z	raise GeneralError(msg) from None
2024-05-15T17:19:20.330Z	supertokens_python.exceptions.GeneralError

An issue in the querier usually indicates that there was an issue from the core service, but there are no error logs from our core service for this call.

As requested by RP in discord our supertokens init is as follows:

supertokens_config = SupertokensConfig(
    connection_uri=os.getenv('SUPER_TOKENS_CORE_SERVICE_URL'),
    api_key=os.getenv('SUPER_TOKENS_API_KEY')
)

app_info = InputAppInfo(
    app_name="Our app name",
    api_domain=os.getenv('API_GATEWAY_URL'),
    website_domain="http://localhost:3000",
    api_base_path="/v1/member/auth",
    website_base_path="/auth",
    api_gateway_path="", 
)

framework = "fastapi"

recipe_list = [
    get_session_recipe(),
    get_email_password_recipe(),
    userroles.init(),
    get_passwordless_recipe(),
    usermetadata.init()
]

init(
    supertokens_config=config.supertokens_config, 
    app_info=config.app_info, 
    framework=config.framework, 
    recipe_list=config.recipe_list, 
    mode="asgi",
)

I also tried using the latest version of the sdk and it still produced the same error.

EricChristensen avatar May 15 '24 19:05 EricChristensen