Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WORKFLOW SDK BUG] Get workflow state raising exception for instances that do not exist #745

Closed
ajstewart opened this issue Oct 23, 2024 · 10 comments
Assignees
Labels

Comments

@ajstewart
Copy link

Expected Behavior

When I run:

state = wf_client.get_workflow_state(instance_id=my_id)

I expect to receive a None response when the instance does not exist, as defined by the docs:

The current state of the workflow instance, or None if the workflow instance does not exist.

Actual Behavior

I am getting an Exception when the instance does not exist:

== APP == grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
== APP == 	status = StatusCode.UNKNOWN
== APP == 	details = "error from internal actor: no such instance exists"
== APP == 	debug_error_string = "UNKNOWN:Error received from peer ipv4:127.0.0.1:55008 {grpc_message:"error from internal actor: no such instance exists", grpc_status:2, created_time:"2024-10-23T10:46:36.084357+01:00"}"

Steps to Reproduce the Problem

The following small app can reproduce by calling the endpoint

import dapr.ext.workflow as wf
import uvicorn

from fastapi import FastAPI


def hello_world(ctx: wf.WorkflowActivityContext):
    """Hello world workflow."""
    return "Hello world!"


def dummy_workflow(ctx: wf.DaprWorkflowContext):
    """Dummy workflow."""
    result = yield ctx.call_activity(hello_world)
    return result


wf_runtime = wf.WorkflowRuntime()
wf_runtime.register_workflow(dummy_workflow)
wf_runtime.register_activity(hello_world)

wf_client = wf.DaprWorkflowClient()

wf_runtime.start()


app = FastAPI()


@app.get("/workflow/{instance_id}")
def get_workflow_state(instance_id: str):
    """Get the workflow state."""
    state = wf_client.get_workflow_state(instance_id=instance_id)

    if state is None:
        return {"message": "Workflow not found"}

    return {"status": state.runtime_status}


if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=5001)

Release Note

RELEASE NOTE:

@dapr-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot dapr-bot added the stale Issue marked as stale by Dapr Bot label Dec 22, 2024
@ajstewart
Copy link
Author

Not stale

@dapr-bot dapr-bot removed the stale Issue marked as stale by Dapr Bot label Dec 22, 2024
@alicejgibbons
Copy link

@ajstewart are you running this locally? and if so, can you share the dapr logs?

@ajstewart
Copy link
Author

ajstewart commented Jan 23, 2025

@alicejgibbons

There aren't any Dapr errors really, I'm assuming the SDK doesn't handle the not found.

Here's the end of the trace that concerns the Dapr bit:

== APP ==   File "/Users/me/github/dapr-test-app/dapr_example.py", line 32, in get_workflow_state
== APP ==     state = wf_client.get_workflow_state(instance_id=instance_id)
== APP ==             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/dapr/ext/workflow/dapr_workflow_client.py", line 123, in get_workflow_state
== APP ==     state = self.__obj.get_orchestration_state(instance_id, fetch_payloads=fetch_payloads)
== APP ==             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/durabletask/client.py", line 124, in get_orchestration_state
== APP ==     res: pb.GetInstanceResponse = self._stub.GetInstance(req)
== APP ==                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/grpc/_channel.py", line 1181, in __call__
== APP ==     return _end_unary_response_blocking(state, call, False, None)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/grpc/_channel.py", line 1006, in _end_unary_response_blocking
== APP ==     raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
== APP ==     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP == grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
== APP == 	status = StatusCode.UNKNOWN
== APP == 	details = "error from internal actor: no such instance exists"
== APP == 	debug_error_string = "UNKNOWN:Error received from peer ipv4:127.0.0.1:52373 {created_time:"2025-01-23T09:21:00.692623+00:00", grpc_status:2, grpc_message:"error from internal actor: no such instance exists"}"
== APP == >

This is from just performing curl -v http://localhost:5001/workflow/test-not-found on the above demo service.

@alicejgibbons
Copy link

Hmm there should always be Dapr logs so maybe if you're running locally the Dapr logs are outputting to a file instead of the terminal?

Is there a .dapr/logs in the same folder if you're using a Dapr multi-app run file? It would be best to look at those sidecar logs since it seems like something is failing on workflow/scheduler set up. You can also change to console using daprdLogDestination: console in the multi-app run file.

@ajstewart
Copy link
Author

ajstewart commented Jan 23, 2025

I guess I meant to say there are Dapr logs but nothing really comes up around this problem, this is the full output with debug level logs:

dapr run --app-id test_app --app-port 5001 --resources-path components --enable-api-logging --log-level debug -- python dapr_example.py
ℹ️  Starting Dapr with id test_app. HTTP Port: 55434. gRPC Port: 55435
Flag --dapr-http-max-request-size has been deprecated, use '--max-body-size 4Mi'
Flag --dapr-http-read-buffer-size has been deprecated, use '--read-buffer-size 4Ki'
INFO[0000] Starting Dapr Runtime -- version 1.14.4 -- commit 583960dc90120616124b60ad2b7820fc0b3edf44  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Log level set to: debug                       app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
WARN[0000] mTLS is disabled. Skipping certificate request and tls validation  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.security type=log ver=1.14.4
DEBU[0000] Loading config from file(s): /Users/me/.dapr/config.yaml  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] metric spec: {0x1400137ff10 <nil> <nil> []}   app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.diagnostics type=log ver=1.14.4
INFO[0000] Using default latency distribution buckets: [1 2 3 4 5 6 8 10 13 16 20 25 30 40 50 65 80 100 130 160 200 250 300 400 500 650 800 1000 2000 5000 10000 20000 50000 100000]  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.diagnostics type=log ver=1.14.4
WARN[0000] The default value for 'spec.metric.http.increasedCardinality' will change to 'false' in Dapr 1.15 or later  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.diagnostics type=log ver=1.14.4
DEBU[0000] Found 0 resiliency configurations in resources path  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Initializing connection to Scheduler in the background  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Attempting to connect to Scheduler at address: localhost:50006  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.scheduler.clients type=log ver=1.14.4
INFO[0000] Scheduler client initialized for address: localhost:50006  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.scheduler.clients type=log ver=1.14.4
INFO[0000] Scheduler client connections created          app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] standalone mode configured                    app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Hot reloading disabled                        app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.hotreload type=log ver=1.14.4
INFO[0000] app id: test_app                              app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] metrics server started on :55436/             app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Dapr trace sampler initialized: ParentBased{root:AlwaysOnSampler,remoteParentSampled:AlwaysOnSampler,remoteParentNotSampled:AlwaysOffSampler,localParentSampled:AlwaysOnSampler,localParentNotSampled:AlwaysOffSampler}  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] local service entry announced: test_app -> 192.168.0.194:55437  app_id=test_app component="nr (mdns/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
INFO[0000] Initialized name resolution to mdns           app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Loading components…                           app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Found component: envvar-secret-store (secretstores.local.env/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Found component: azure-blob-prod (bindings.azure.blobstorage/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Loading component: envvar-secret-store (secretstores.local.env/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
INFO[0000] Component loaded: envvar-secret-store (secretstores.local.env/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Loading component: azure-blob-prod (bindings.azure.blobstorage/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Found component: azure-blob-data (bindings.azure.blobstorage/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Using custom endpoint for Azure Blob Storage  app_id=test_app component="azure-blob-prod (bindings.azure.blobstorage/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
INFO[0000] successful init for output binding (azure-blob-prod (bindings.azure.blobstorage/v1))  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor.binding type=log ver=1.14.4
INFO[0000] Component loaded: azure-blob-prod (bindings.azure.blobstorage/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Loading component: azure-blob-data (bindings.azure.blobstorage/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Found component: poison-queue (bindings.azure.storagequeues/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Using custom endpoint for Azure Blob Storage  app_id=test_app component="azure-blob-data (bindings.azure.blobstorage/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
INFO[0000] successful init for output binding (azure-blob-data (bindings.azure.blobstorage/v1))  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor.binding type=log ver=1.14.4
INFO[0000] Component loaded: azure-blob-data (bindings.azure.blobstorage/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Loading component: poison-queue (bindings.azure.storagequeues/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Found component: dapr-queue (bindings.azure.storagequeues/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] successful init for output binding (poison-queue (bindings.azure.storagequeues/v1))  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor.binding type=log ver=1.14.4
INFO[0000] Component loaded: poison-queue (bindings.azure.storagequeues/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Loading component: dapr-queue (bindings.azure.storagequeues/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Found component: my-oauth2-client-credentials (middleware.http.oauth2clientcredentials/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] successful init for input binding (dapr-queue (bindings.azure.storagequeues/v1))  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor.binding type=log ver=1.14.4
INFO[0000] Component loaded: dapr-queue (bindings.azure.storagequeues/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Loading component: my-oauth2-client-credentials (middleware.http.oauth2clientcredentials/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Found component: pubsub (pubsub.redis/v1)     app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Adding middleware.http.oauth2clientcredentials/v1 my-oauth2-client-credentials middleware  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.middleware.http type=log ver=1.14.4
INFO[0000] Component loaded: my-oauth2-client-credentials (middleware.http.oauth2clientcredentials/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Loading component: pubsub (pubsub.redis/v1)   app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Found component: statestore (state.sqlite/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Component loaded: pubsub (pubsub.redis/v1)    app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
DEBU[0000] Loading component: statestore (state.sqlite/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
INFO[0000] Waiting for all outstanding components to be processed…  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] prefix 'file:' added to the connection string  app_id=test_app component="statestore (state.sqlite/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
DEBU[0000] Migrate: start                                app_id=test_app component="statestore (state.sqlite/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
DEBU[0000] Migrate: ensure metadata table exists         app_id=test_app component="statestore (state.sqlite/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
DEBU[0000] Migrate: load current migration level         app_id=test_app component="statestore (state.sqlite/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
DEBU[0000] Migrate: current migration level: 1           app_id=test_app component="statestore (state.sqlite/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
INFO[0000] Using 'statestore' as actor state store       app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor.state type=log ver=1.14.4
INFO[0000] Component loaded: statestore (state.sqlite/v1)  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor type=log ver=1.14.4
INFO[0000] All outstanding components processed          app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Loading endpoints…                            app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Waiting for all outstanding http endpoints to be processed…  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] All outstanding http endpoints processed      app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Loading Declarative Subscriptions…            app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Refreshing channels                           app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.channels type=log ver=1.14.4
DEBU[0000] Channels refreshed                            app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.channels type=log ver=1.14.4
INFO[0000] gRPC server listening on TCP address: :55435  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.grpc.api type=log ver=1.14.4
INFO[0000] Enabled gRPC tracing middleware               app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.grpc.api type=log ver=1.14.4
INFO[0000] Enabled gRPC metrics middleware               app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.grpc.api type=log ver=1.14.4
INFO[0000] Registering workflow engine for gRPC endpoint: [::]:55435  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.grpc.api type=log ver=1.14.4
INFO[0000] API gRPC server is running on port 55435      app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
WARN[0000] The default value for 'spec.metric.http.increasedCardinality' will change to 'false' in Dapr 1.15 or later  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.http type=log ver=1.14.4
INFO[0000] Enabled max body size HTTP middleware with size 4194304 bytes  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.http type=log ver=1.14.4
INFO[0000] Enabled tracing HTTP middleware               app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.http type=log ver=1.14.4
INFO[0000] Enabled metrics HTTP middleware               app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.http type=log ver=1.14.4
INFO[0000] HTTP server listening on TCP address: :55434  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.http type=log ver=1.14.4
INFO[0000] HTTP server is running on port 55434          app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] The request body size parameter is: 4194304 bytes  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] gRPC server listening on TCP address: :55437  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.grpc.internal type=log ver=1.14.4
INFO[0000] Enabled gRPC tracing middleware               app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.grpc.internal type=log ver=1.14.4
INFO[0000] Enabled gRPC metrics middleware               app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.grpc.internal type=log ver=1.14.4
INFO[0000] Internal gRPC server is running on :55437     app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] application protocol: http. waiting on port 5001.  This will block until the app is listening on that port.  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
== APP == 2025-01-23 15:49:26.421 durabletask-worker INFO: Starting gRPC worker that connects to dns:127.0.0.1:55435
INFO[0000] gRPC API Called                               app_id=test_app code=0 duration=0 instance=My-MacBook-Pro.local method=/TaskHubSidecarService/Hello scope=dapr.runtime.grpc.api-info type=log useragent="grpc-python/1.69.0 grpc-c/44.2.0 (osx; chttp2)" ver=1.14.4
== APP == 2025-01-23 15:49:26.436 durabletask-worker INFO: Successfully connected to dns:127.0.0.1:55435. Waiting for work items...
INFO[0000] work item stream established by user-agent: [grpc-python/1.69.0 grpc-c/44.2.0 (osx; chttp2)]  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.wfengine type=log ver=1.14.4
== APP == INFO:     Started server process [76463]
== APP == INFO:     Waiting for application startup.
== APP == INFO:     Application startup complete.
== APP == INFO:     Uvicorn running on http://0.0.0.0:5001 (Press CTRL+C to quit)
INFO[0000] application discovered on port 5001           app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
== APP == INFO:     127.0.0.1:55458 - "GET /dapr/config HTTP/1.1" 404 Not Found
INFO[0000] Application configuration loaded              app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Configuring actors placement provider 'placement'. Configuration: 'placement:localhost:50005'  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=1.14.4
INFO[0000] Configuring actor reminders provider 'default'. Configuration: ''  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=1.14.4
INFO[0000] Actor runtime started. Idle timeout: 1h0m0s   app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=1.14.4
INFO[0000] Configuring workflow engine with actors backend  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Registering component for dapr workflow engine...  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
INFO[0000] Initializing Dapr workflow component          app_id=test_app component="dapr (workflow.dapr/v1)" instance=My-MacBook-Pro.local scope=dapr.contrib type=log ver=1.14.4
INFO[0000] Workflow engine initialized.                  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Registered internal actor type 'dapr.internal.default.test_app.workflow'  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=1.14.4
DEBU[0000] Registered internal actor type 'dapr.internal.default.test_app.activity'  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=1.14.4
INFO[0000] worker started with backend dapr.actors/v1-beta  app_id=test_app instance=My-MacBook-Pro.local scope=wfengine.durabletask.backend type=log ver=1.14.4
INFO[0000] Workflow engine started                       app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.wfengine type=log ver=1.14.4
DEBU[0000] Actor backend is waiting for an activity actor to schedule an invocation.  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.wfengine.backend.actors type=log ver=1.14.4
DEBU[0000] Actor backend is waiting for a workflow actor to schedule an invocation.  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.wfengine.backend.actors type=log ver=1.14.4
DEBU[0000] try to connect to placement service: dns:///localhost:50005  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actors.placement type=log ver=1.14.4
== APP == INFO:     127.0.0.1:55458 - "GET /dapr/subscribe HTTP/1.1" 404 Not Found
INFO[0000] Scheduler stream connected                    app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.scheduler type=log ver=1.14.4
DEBU[0000] user app did not subscribe to any topic       app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor.subscription type=log ver=1.14.4
DEBU[0000] app responded with subscriptions []           app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.processor.subscription type=log ver=1.14.4
INFO[0000] dapr initialized. Status: Running. Init Elapsed 686ms  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime type=log ver=1.14.4
DEBU[0000] Established connection to placement service at dns:///localhost:50005  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actors.placement type=log ver=1.14.4
INFO[0000] HTTP API Called                               app_id=test_app code=204 duration=0 instance=My-MacBook-Pro.local method="PUT /v1.0/metadata/cliPID" scope=dapr.runtime.http-info size=0 type=log useragent=Go-http-client/1.1 ver=1.14.4
ℹ️  Updating metadata for appPID: 76463
INFO[0000] HTTP API Called                               app_id=test_app code=204 duration=0 instance=My-MacBook-Pro.local method="PUT /v1.0/metadata/appPID" scope=dapr.runtime.http-info size=0 type=log useragent=Go-http-client/1.1 ver=1.14.4
ℹ️  Updating metadata for app command: python dapr_example.py
INFO[0000] HTTP API Called                               app_id=test_app code=204 duration=0 instance=My-MacBook-Pro.local method="PUT /v1.0/metadata/appCommand" scope=dapr.runtime.http-info size=0 type=log useragent=Go-http-client/1.1 ver=1.14.4
✅  You're up and running! Both Dapr and your app logs will appear here.

DEBU[0002] Placement order received: lock                app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actors.placement type=log ver=1.14.4
DEBU[0002] Placement order received: update              app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actors.placement type=log ver=1.14.4
INFO[0002] Actor API level in the cluster has been updated to 10  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=1.14.4
INFO[0002] Placement tables updated, version: 11         app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actors.placement type=log ver=1.14.4
DEBU[0002] Placement order received: unlock              app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actors.placement type=log ver=1.14.4
DEBU[0002] Starting to read reminders for actor type dapr.internal.default.test_app.workflow (migrate=true), with metadata id 00000000-0000-0000-0000-000000000000 and 0 partitions  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0002] Read reminders from actors||dapr.internal.default.test_app.workflow without partition  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0002] Finished reading reminders for actor type dapr.internal.default.test_app.workflow (migrate=true), with metadata id 00000000-0000-0000-0000-000000000000 and no partitions: total of 0 reminders  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0002] Loaded 0 reminders for actor type dapr.internal.default.test_app.workflow  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0002] Starting to read reminders for actor type dapr.internal.default.test_app.activity (migrate=true), with metadata id 00000000-0000-0000-0000-000000000000 and 0 partitions  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0002] Read reminders from actors||dapr.internal.default.test_app.activity without partition  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0002] Finished reading reminders for actor type dapr.internal.default.test_app.activity (migrate=true), with metadata id 00000000-0000-0000-0000-000000000000 and no partitions: total of 0 reminders  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0002] Loaded 0 reminders for actor type dapr.internal.default.test_app.activity  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.runtime.actor.reminders type=log ver=1.14.4
DEBU[0006] Workflow actor 'test-not-found': invoking method 'GetWorkflowMetadata'  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.wfengine.backend.actors type=log ver=1.14.4
DEBU[0006] Workflow actor 'test-not-found': loading workflow state  app_id=test_app instance=My-MacBook-Pro.local scope=dapr.wfengine.backend.actors type=log ver=1.14.4
INFO[0006] gRPC API Called                               app_id=test_app code=2 duration=0 instance=My-MacBook-Pro.local method=/TaskHubSidecarService/GetInstance scope=dapr.runtime.grpc.api-info type=log useragent="grpc-python/1.69.0 grpc-c/44.2.0 (osx; chttp2)" ver=1.14.4
== APP == INFO:     127.0.0.1:55473 - "GET /workflow/test-not-found HTTP/1.1" 500 Internal Server Error
== APP == ERROR:    Exception in ASGI application
== APP == Traceback (most recent call last):
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
== APP ==     result = await app(  # type: ignore[func-returns-value]
== APP ==              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
== APP ==     return await self.app(scope, receive, send)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
== APP ==     await super().__call__(scope, receive, send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/applications.py", line 113, in __call__
== APP ==     await self.middleware_stack(scope, receive, send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
== APP ==     raise exc
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
== APP ==     await self.app(scope, receive, _send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
== APP ==     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
== APP ==     raise exc
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
== APP ==     await app(scope, receive, sender)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
== APP ==     await self.middleware_stack(scope, receive, send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
== APP ==     await route.handle(scope, receive, send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
== APP ==     await self.app(scope, receive, send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
== APP ==     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
== APP ==     raise exc
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
== APP ==     await app(scope, receive, sender)
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
== APP ==     response = await f(request)
== APP ==                ^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
== APP ==     raw_response = await run_endpoint_function(
== APP ==                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
== APP ==     return await run_in_threadpool(dependant.call, **values)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/starlette/concurrency.py", line 39, in run_in_threadpool
== APP ==     return await anyio.to_thread.run_sync(func, *args)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
== APP ==     return await get_async_backend().run_sync_in_worker_thread(
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
== APP ==     return await future
== APP ==            ^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
== APP ==     result = context.run(func, *args)
== APP ==              ^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/Users/me/github/dapr-test-app/dapr_example.py", line 32, in get_workflow_state
== APP ==     state = wf_client.get_workflow_state(instance_id=instance_id)
== APP ==             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/dapr/ext/workflow/dapr_workflow_client.py", line 123, in get_workflow_state
== APP ==     state = self.__obj.get_orchestration_state(instance_id, fetch_payloads=fetch_payloads)
== APP ==             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/durabletask/client.py", line 124, in get_orchestration_state
== APP ==     res: pb.GetInstanceResponse = self._stub.GetInstance(req)
== APP ==                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/grpc/_channel.py", line 1181, in __call__
== APP ==     return _end_unary_response_blocking(state, call, False, None)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/opt/homebrew/Caskroom/mambaforge/base/envs/dapr-test-app/lib/python3.11/site-packages/grpc/_channel.py", line 1006, in _end_unary_response_blocking
== APP ==     raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
== APP ==     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP == grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
== APP == 	status = StatusCode.UNKNOWN
== APP == 	details = "error from internal actor: no such instance exists"
== APP == 	debug_error_string = "UNKNOWN:Error received from peer ipv4:127.0.0.1:55435 {grpc_message:"error from internal actor: no such instance exists", grpc_status:2, created_time:"2025-01-23T15:49:32.189815+00:00"}"
== APP == >

@elena-kolevska
Copy link
Contributor

elena-kolevska commented Jan 28, 2025

Hey @ajstewart , this error in fact comes from Dapr. It is a confusing error message but it has since been updated to no such instance exists in the latest (1.15.0 rc7) release.
I'll send a PR to do the try/catch in the sdk itself, so you don't have to do it as a user.

@ajstewart
Copy link
Author

Thanks @elena-kolevska.

I guess it was because the docs said it should return None, personally I also prefer the error being raised explicitly like it is.

@elena-kolevska
Copy link
Contributor

Hey @ajstewart, here's a PR that addresses this: #771
Feel free to review and give your thoughts.

@elena-kolevska
Copy link
Contributor

The PR is now merged and will be a part of the next release (1.15.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants