Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: ZodErrors
description: "Adds additional data to Zod validation errors."
---

_Import name: `Sentry.zodErrorsIntegration`_

The Zod Errors integration enhances error reporting for applications using [Zod](https://zod.dev/) schema validation.
When Zod validation fails, this integration captures detailed validation errors (`ZodError` instances) and attaches them
as additional data to Sentry events.

The Zod Errors integration is not enabled by default. You need to add it to your Sentry configuration:

```javascript
Sentry.init({
integrations: [
Sentry.zodErrorsIntegration(),
],
});
```

## Options

The `zodErrorsIntegration` accepts the following options:

### `limit`

_Type: `number`_
_Default: `10`_

Limits the number of Zod errors inlined in each Sentry event.

### `saveZodIssuesAsAttachment`

_Type: `boolean`_
_Default: `false`_

Save full list of Zod issues as a JSON attachment in Sentry.

## Example Additional Error Data

When a Zod validation error occurs, you'll see enhanced error information in Sentry like this:

```json
[
{
"code": "too_small",
"path": ["name"],
"message": "Name is required",
"minimum": 1,
"type": "string",
"inclusive": true,
"received": ""
},
{
"code": "invalid_string",
"path": ["email"],
"message": "Invalid email format",
"validation": "email",
"received": "invalid-email"
}
]
```
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`tediousIntegration`](./tedious) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
| [`localVariablesIntegration`](./localvariables) | | ✓ | | |
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`tediousIntegration`](./tedious) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`unleashIntegration`](./unleash) | | | | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Depending on whether an integration enhances the functionality of a particular r
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |

### Edge Integrations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@
| [`tediousIntegration`](./tedious) | ✓ | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`openAIIntegration`](./openai) | ✓ | | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |