Skip to main content

Report app errors using Retool Events

Build Retool Event-triggered workflows that automatically send app error reports to any third-party observability provider.

In addition to built-in support for reporting app errors to Datadog or Sentry, you can use Retool Events to build workflows that automatically trigger whenever an app error occurs. This can be useful for automatically notifying third-party observability providers.

A workflow to send app errors to Sentry using a JavaScript SDK.

Add a workflow for the event

First, navigate to the settings in your organization. Click Add a workflow to select or create a workflow for the Report App Errors event.

Add a workflow for the Report App Errors event.

You can download an example workflow for Datadog, Rollbar, or Sentry as a JSON file and import it as a new workflow. Each workflow contains sample error data for you to use during testing.

Transform error data

The App Error event contains detailed information about the error. Observability providers require data to be in a particular shape. You can use the Code block within a workflow to transform the error data into a suitable payload before using a Resource query block to send it.

The following app error example uses JavaScript to transform the error into a digestible format for Datadog.

App error example
{
"errors": [
{
"id": "50f1ffbf-58e7-44f1-9a6b-5bed45fee232",
"timestamp": 18,
"origin": "runtime",
"appUuid": "91e36cb2-2d20-11ef-9a6c-378c1a9d5665",
"callstack": [
{
"type": "error",
"message": "workflow error",
"lineNumber": 2,
"id": "0/transformerRun-1718685005587-0/transformerFailure-1718685005588-1/error-1718685005588-2",
"timestamp": 1718685005588
},
{
"type": "transformerFailure",
"transformerId": "transformer1",
"id": "0/transformerRun-1718685005587-0/transformerFailure-1718685005588-1",
"timestamp": 1718685005588
},
{
"type": "transformerRun",
"transformerId": "transformer1",
"id": "0/transformerRun-1718685005587-0",
"timestamp": 1718685005587
},
{ "type": "loadEvent", "id": "0", "timestamp": 1718685005587 }
],
"tags": {}
}
]
}

Send errors to an observability provider

Observability providers typically receive error logs using an API or SDK. The method you use depends on the provider.

  • Using an API (e.g., Datadog or Rollbar): Create a resource that's configured with the necessary settings. You can then select this resource in the workflow.
  • Using a JavaScript SDK (e.g., Sentry): If necessary, use configuration variables to store secret keys. You can then reference them when using custom JavaScript or Python libraries to send app errors without exposing sensitive information in the workflow.

You can send app errors to most observability providers with an API or SDK. The following examples explain how to send errors to Datadog, Rollbar, and Sentry.

Add a Resource query block to the workflow and select the REST API resource. To send error logs, use the POST /api/v2/logs endpoint, add your Datadog API Key to the header, and provide the transformed data as the raw body in the request.

A Resource query block to send app errors to Datadog.

Deploy the workflow

Once you create a workflow, you must deploy it to begin automatically sending app error reports to providers. Whenever you make changes to a workflow, you must also deploy those changes for them to take effect.

After deploying the workflow, create an app and perform actions that would cause an error. For example:

  • Write an invalid query that fails to run.
  • Create a test resource, reference it in the app in a query, then delete the resource.