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
@register_activity
@activity.defn
async def get_http_response(URL: str) -> dict:
async with httpx.AsyncClient() as client:
return await client.get(url)
Describe the bug
We get the following error:
RestrictedWorkflowAccessError
Cannot access threading.local.mro_entries from inside a workflow. If this is code from a module not used in a workflow or known to only be used deterministically from a workflow, mark the import as pass through.
Minimal Reproduction
I believe the workflow sandbox is reactivated before the asynclient __aexit__ code.
Which leads to Temporal thinking its execution is happening in the workflow scope rather than within the activity one.
Environment/Versions
temporal==1.10.0
Additional context
I'm trying to split it in two calls to make it work:
@register_activity
@activity.defn
async def get_http_response(URL: str) -> dict:
async with httpx.AsyncClient() as client:
response = await client.get(url)
return response