You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using Cube Cloud, and sending additional information in the Cube Token via the API, the Security Context in driver_factory is empty. This was working in Javascript. We need to pass additional dynamic data in order to set up multitenancy and would prefer to use the Python implementation.
Edit: this does work in Dev Mode
To Reproduce
Create an encoded JWT with the following in the payload, and set the secret to your configured CUBE_API_SECRET
{
"iat": 1719909131,
"user_id": 28
}
Create the following Cube.py
from cube import config
@config('driver_factory')
def driver_factory(ctx: dict) -> None:
try:
print(ctx)
user = default_userId
warehouse = default_warehouse
account = default_account
database = default_database
if not user or not warehouse:
raise ValueError("Missing userId or warehouse in securityContext")
return {
'type': 'snowflake',
'user': user,
'private_key': private_key_content,
'database': database,
'warehouse': warehouse
}
except Exception as e:
print(f"Error in driver_factory: {e}")
return None
Run a curl request with the created JWT and your REST API url.
Expected behavior
Printing ctx in the logs shows "securityContext":{"iat":1719909131,"user_id":28}
Describe the bug
When using Cube Cloud, and sending additional information in the Cube Token via the API, the Security Context in
driver_factory
is empty. This was working in Javascript. We need to pass additional dynamic data in order to set up multitenancy and would prefer to use the Python implementation.Edit: this does work in Dev Mode
To Reproduce
CUBE_API_SECRET
Expected behavior
Printing
ctx
in the logs shows"securityContext":{"iat":1719909131,"user_id":28}
Results
From logs
Version:
[e.g. 0.35.55]
Additional context
Possibly related to
#8133
The text was updated successfully, but these errors were encountered: