Closed lotabout closed 2 days ago
@lotabout Hello there! I'm here to assist you with any bugs, questions, or contributions. Let's work together to resolve your issue.
The LookupError
for the tenant_id
ContextVar occurs when there is an attempt to access its value before it has been set in the current context. In the case of logging in via ADMIN_API_KEY
, it seems that the tenant_id
is not being set properly before it is accessed.
To resolve this issue, ensure that the tenant_id
is correctly set in the context when handling requests authenticated with the ADMIN_API_KEY
. This typically involves setting the tenant_id
after successfully validating the ADMIN_API_KEY
and retrieving the corresponding tenant information using the X-WORKSPACE-ID
header. Make sure that the logic for setting the tenant_id
is consistent with how it is set when using user JWT tokens, as the expected behavior is for both authentication methods to handle context variables similarly [1].
To continue talking to Dosu, mention @dosu.
Self Checks
Dify version
0.10.2
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
Setting the following environment:
create an app in web pages
send the following request:
and the error is reproduced.
✔️ Expected Behavior
The request returns normally just like the user's JWT tokens.
❌ Actual Behavior
No response