This page shows you how to resolve issues that you might encounter when using
Eventarc for Workflows.

For other issues that you might also encounter, refer to troubleshooting for:

- [Issues common to all destinations](https://docs.cloud.google.com/eventarc/docs/troubleshooting.md.txt)
- [Eventarc for Cloud Run](https://docs.cloud.google.com/eventarc/standard/docs/run/troubleshoot.md.txt)
- [Eventarc for GKE](https://docs.cloud.google.com/eventarc/standard/docs/gke/troubleshooting.md.txt)

### Trigger creation fails because workflow target does not exist

You receive an error message similar to the following:

```
cloud workflow "projects/PROJECT_ID/locations/LOCATION/workflows/WORKFLOW_ID" does not exist
```
This output includes the following values:

<br />

- `PROJECT_ID`: your Google Cloud project ID
- `LOCATION`: the location of your workflow
- `WORKFLOW_ID`: the name of your workflow

This occurs when Eventarc is not able to find the target workflow.
To resolve this:

1. Ensure that the target workflow exists and is ACTIVE:

   ```bash
   gcloud workflows list --location -
   ```

   <br />

   The output should be similar to the following:

   ```
   NAME                                                          STATE   REVISION_ID  UPDATE_TIME
   projects/PROJECT_ID/locations/LOCATION/workflows/WORKFLOW_ID  ACTIVE  000004-c0c   2021-11-19T14:29:27.530185556Z
   ```

   <br />

2. Ensure that you have provided the correct workflow ID and workflow location
   when creating the trigger.

### Trigger is created successfully but target is not receiving events

Check that enough time has elapsed since creating the trigger. It can take up to
two minutes before events are sent.

If the trigger still doesn't work and events are not being delivered:

1. Events sent from Pub/Sub to the
   target might be getting dropped. To ensure that events aren't dropped,
   [set up a Pub/Sub subscription retry policy](https://docs.cloud.google.com/pubsub/docs/subscription-retry-policy.md.txt)
   or [forward undelivered messages to a dead-letter topic](https://docs.cloud.google.com/pubsub/docs/dead-letter-topics.md.txt)
   (also known as a *dead-letter queue*).

   Before setting the dead-letter topic, retrieve the trigger's topic and
   subscription:

   ```bash
   gcloud eventarc triggers describe TRIGGER \
   --location=LOCATION
   ```

   Replace the following:
   - `TRIGGER`: the ID of the trigger or a fully qualified identifier.
   - `LOCATION`: the location of the Eventarc trigger.
2. Use the Google Cloud console to
   [monitor](https://docs.cloud.google.com/pubsub/docs/monitoring.md.txt#monitoring_forwarded_undeliverable_messages)
   if messages are published to the Pub/Sub topic with the
   metric: `topic/send_message_operation_count`.

3. If messages are not being published to Pub/Sub topic, verify that
   the source is generating events:

   - For events from Cloud Audit Logs, check the [logs](https://docs.cloud.google.com/eventarc/docs/reference/audit-logs.md.txt#viewing_logs) and make sure that the monitored service is writing logs. If logs are recorded but events are not delivered, [contact support](https://docs.cloud.google.com/eventarc/docs/getting-support.md.txt).
   - For events from Cloud Storage, check notifications for your bucket:

     ```
     gcloud storage buckets notifications list gs://BUCKET_NAME
     ```
     Replace `BUCKET_NAME` with the name of the bucket.  
     The output should be similar to the following:

     <br />

     ```
     projects/_/buckets/BUCKET_NAME/notificationConfigs/NOTIFICATION_CONFIG_ID
     Cloud Pub/Sub topic: projects/PROJECT_ID/topics/TOPIC_ID
     Filters:
       Event Types: OBJECT_ARCHIVE
     ```

     This output includes the following values:
     - `TOPIC_ID`: the ID of the existing Pub/Sub topic.
     - `NOTIFICATION_CONFIG_ID`: the ID of the notification configuration.
4. If events are being delivered but no workflow executions are being triggered,
   this is likely due to an unauthenticated invocation. Ensure that the
   trigger is associated with a service account that has permission to create
   workflow executions. For more information, follow the instructions to create
   a user-managed service account in the "Prepare to create a trigger" section
   when creating a trigger for a
   [specific provider, event type, and Workflows destination](https://docs.cloud.google.com/eventarc/standard/docs/event-providers-targets.md.txt#triggers)
   .

5. If messages are published to a Pub/Sub topic
   but no workflow executions are being triggered, make sure that the
   Eventarc payload is not more than 512 KB. For more
   information on resource limits, see [Quotas and Limits](https://docs.cloud.google.com/workflows/quotas.md.txt#resource_limit).

   1. In the Cloud console, go to the **Subscriptions** page.


      [Go to Subscriptions](https://console.cloud.google.com/cloudpubsub/subscription/list)

      <br />

   2. Monitor unacknowledged messages in the subscription. For more information,
      see [Monitoring forwarded undeliverable messages](https://docs.cloud.google.com/pubsub/docs/monitoring.md.txt#monitoring_forwarded_undeliverable_messages).

   3. If there are unacknowledged messages, monitor the workflow logs for the
      [`TriggerPubsubExecution` method](https://docs.cloud.google.com/eventarc/docs/reference/supported-events.md.txt#methodname_119).
      For more information on viewing workflow logs, see [View workflow logs](https://docs.cloud.google.com/workflows/docs/log-workflow.md.txt#viewing-logs).

      - Use the filter `Permission 'workflows.executions.create' denied` to verify if the trigger is associated with a service account that has permission to trigger workflow executions. For more information on how to grant the appropriate roles to the service account, follow the instructions in the "Prepare to create a trigger" section when creating a trigger for a [specific provider, event type, and Workflows destination](https://docs.cloud.google.com/eventarc/standard/docs/event-providers-targets.md.txt#triggers).
      - Use the key word `event size exceeded` to verify if the event size is over 512 KB.
   4. If logs are recorded but events are not delivered, [contact support](https://docs.cloud.google.com/eventarc/docs/getting-support.md.txt).

## Related information

- For other issues specific to Workflows, see [Troubleshoot issues](https://docs.cloud.google.com/workflows/docs/troubleshooting.md.txt).
- To get additional help, see [Get support](https://docs.cloud.google.com/eventarc/docs/getting-support.md.txt).