> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.generaltranslation.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Testing, Observability, and Failure Recovery

> Learn more about testing and managing your events and event streams. 

<Warning>
  **Events are currently available in [Early Access](/docs/ja-JP/ja-jp/troubleshoot/product-lifecycle/product-release-stages)** . By using this feature, you agree to the applicable Free Trial terms in Okta’s [Master Subscription Agreement](https://auth0.com/docs/ja-jp/troubleshoot/product-lifecycle/product-release-stages)

  To learn more about Auth0's product release cycle, review [Product Release Stages](/docs/ja-JP/ja-jp/troubleshoot/product-lifecycle/product-release-stages).
</Warning>

The following sections provide information about testing event streams and managing events.

<div id="test-the-event-stream">
  ## Test the event stream
</div>

After you create and enable an event stream using either AWS EventBridge or webhooks, you can test the new stream. Currently, Auth0 does not support sending events to disabled event streams.

To test your event stream, first create a user for your application by running the following with your preferred credentials:

<Tabs>
  <Tab title="Auth0 CLI">
    ```bash lines theme={null}
    auth0 users create # follow prompts to create a test user
    ```
  </Tab>

  <Tab title="cURL">
    ```bash lines theme={null}
    curl -s \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -X POST https://$TENANT/api/v2/users \
      -d '{
            "email": "nick-testing-21@example.com",
            "password": "Password123!",
            "connection": "Username-Password-Authentication"
          }'
    ```
  </Tab>
</Tabs>

After the user is created, it should trigger the `user.created` event in your event stream and return a response. In this example, webhooks are used to facilitate the event stream.

```json lines expandable theme={null}
"Webhook received": {
  "id": "evt_6SfwXrtm8nVcjzzNCFFH1L",
  "source": "urn:auth0:",
  "specversion": "1.0",
  "type": "user.created",
  "time": "2025-02-02T17:56:01.573Z",
  "data": {
    "object": {
      "created_at": "2025-02-02T17:56:01.566Z",
      "email": "nick-testing-21@example.com",
      "email_verified": false,
      "identities": [
        {
          "connection": "Username-Password-Authentication",
          "isSocial": false,
          "provider": "auth0",
          "user_id": "679fb1b1e809445f129bc18d"
        }
      ],
      "name": "nick-testing-21@example.com",
      "nickname": "nick-testing-21",
      "picture": "test.png",
      "updated_at": "2025-02-02T17:56:01.566Z",
      "user_id": "auth0|679fb1b1e809445f129bc18d"
    }
  },
  "a0tenant": "acme",
  "a0stream": "est_38ANnv8pQhqsZrX2VFbftv",
  "a0purpose": "test"
}
```

You can list the event delivery failures for a specific event stream by running:

<Tabs>
  <Tab title="Auth0 CLI">
    ```bash lines theme={null}
    auth0 api get event-streams/$EVENT_STREAM_ID/deliveries
    ```
  </Tab>

  <Tab title="cURL">
    ```bash lines theme={null}
    curl -s -H "Authorization: Bearer $TOKEN" \
      "https://$TENANT/api/v2/event-streams/${EVENT_STREAM_ID}/deliveries" | jq .
    ```
  </Tab>
</Tabs>

If an empty delivery failure array is returned, your event stream is running correctly.

<div id="observability">
  ## Observability
</div>

To ensure the reliability of event streams, implement a monitoring process that periodically checks for delivery failures and triggers alerts when necessary.

<div id="polling-deliveries-endpoint">
  ### Polling Deliveries endpoint
</div>

Poll the Deliveries endpoint every **5 minutes** to check for failed events. Use the following API call to fetch recent event deliveries:

<Tabs>
  <Tab title="Auth0 CLI">
    ```bash lines theme={null}
    auth0 api get event-streams/$EVENT_STREAM_ID/deliveries
    ```
  </Tab>

  <Tab title="cURL">
    ```bash lines theme={null}
    curl -s -H "Authorization: Bearer $TOKEN" \
      "https://$TENANT/api/v2/event-streams/${EVENT_STREAM_ID}/deliveries" | jq .
    ```
  </Tab>
</Tabs>

If failures are detected:

* Log the failed event details.
* Alert the appropriate team or system to review and diagnose the issue.

<div id="recovery">
  ## Recovery
</div>

Event delivery will automatically retry. To learn more, review [Best Practices](https://auth0.com/docs/customize/events/event-testing-observability-and-failure-recovery#batch-redelivery-of-failed-events).

If failures occur, use the Redelivery API to attempt event delivery again.

<div id="redeliver-a-single-failed-event">
  ### Redeliver a single failed event
</div>

To retry a specific failed event, use:

<Tabs>
  <Tab title="Auth0 CLI">
    ```bash lines theme={null}
    EVENT_ID=<your event id>
    auth0 api POST event-streams/$EVENT_STREAM_ID/redeliver/$EVENT_ID --data '{}'
    ```
  </Tab>

  <Tab title="cURL">
    ```bash lines theme={null}
    curl -s -X POST -H "Authorization: Bearer $TOKEN" \
      "https://<your-domain>/api/v2/event-streams/$EVENT_STREAM_ID/redeliver/$EVENT_ID"
    ```
  </Tab>
</Tabs>

<div id="batch-redelivery-of-failed-events">
  ### Batch redelivery of failed events
</div>

To retry all failed events in the event stream:

<Tabs>
  <Tab title="Auth0 CLI">
    ```bash wrap lines theme={null}
    auth0 api POST event-streams/$EVENT_STREAM_ID/redeliver --data '{}'
    ```
  </Tab>

  <Tab title="cURL">
    ```bash lines theme={null}
    curl -s -X POST -H "Authorization: Bearer $TOKEN" \
      "https://<your-tenant>.auth0.com/api/v2/event-streams/<event_stream_id>/redeliver"
    ```
  </Tab>
</Tabs>

<div id="auto-disable-mechanism">
  ### Auto-disable mechanism
</div>

Auth0 automatically disables an event stream if excessive failures occur.

<table class="table">
  <thead>
    <tr>
      <th><b>Condition</b></th>
      <th><b>Action taken</b></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>500 consecutive failures</td>
      <td>Event stream is disabled automatically.</td>
    </tr>

    <tr>
      <td>5000 total failures</td>
      <td>Event stream is disabled automatically.</td>
    </tr>
  </tbody>
</table>

* If an event stream is auto-disabled, you **must** use the Redelivery API to process any failed events.
* The event stream **cannot** be manually re-enabled until the total failure count drops below 5000.
* Once the number of failures is reduced, you can re-enable the stream via API.

<div id="learn-more">
  ## もっと詳しく
</div>

* [Event Types](/docs/ja-JP/ja-jp/customize/events/event-types)
* [Create an Event Stream](/docs/ja-JP/ja-jp/customize/events/create-an-event-stream)
* [Events Best Practices](/docs/ja-JP/ja-jp/customize/events/events-best-practices)
