UNAUTHENTICATED Error (Status Code 401) with Cloud Function Task Creation

jwu
Bronze 1
Bronze 1

I'm leveraging a cloud function to create HTTP tasks for queueing workflow executions, employing a service account with the workflow invoker roles ("roles/workflows.invoker") to invoke the workflow, like the following diagram.

Cloud Funtion --> Task Queue --> Workflows

This account is set as the `serviceAccountEmail` in the `oidcToken` for HTTP request authentication using the Cloud library in Node.js. Despite the setup, executing the function yields a task but the queue details in Cloud console returns status code: "16 (UNAUTHENTICATED)" with reason to retry: "UNAUTHENTICATED(16): HTTP status code 401".

Questions:

  1. Are there additional roles required for the service account that I might have missed, essential for invoking the workflow API?
  2. Could the issue stem from insufficient permissions to access the target URL, namely the workflow API?
  3. Is there a possibility of an incorrect configuration in my authentication header leading to this error?
0 0 105
0 REPLIES 0