|
| 1 | +<p align="center"> |
| 2 | + <a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank"> |
| 3 | + <img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84"> |
| 4 | + </a> |
| 5 | +</p> |
| 6 | + |
| 7 | +# Official Sentry SDK for Nitro |
| 8 | + |
| 9 | +[](https://www.npmjs.com/package/@sentry/nitro) |
| 10 | +[](https://www.npmjs.com/package/@sentry/nitro) |
| 11 | +[](https://www.npmjs.com/package/@sentry/nitro) |
| 12 | + |
| 13 | +## Links |
| 14 | + |
| 15 | +- [Official Nitro SDK Docs](https://docs.sentry.io/platforms/javascript/guides/nitro/) |
| 16 | + |
| 17 | +## Compatibility |
| 18 | + |
| 19 | +The minimum supported version of Nitro is `3.0.0-alpha.1`. |
| 20 | + |
| 21 | +## General |
| 22 | + |
| 23 | +This package is a wrapper around `@sentry/node` with added instrumentation for Nitro's features like: |
| 24 | + |
| 25 | +- HTTP handlers and error capturing. |
| 26 | +- [Middleware instrumentation](https://nitro.build/guide/routing#middleware). |
| 27 | + <!-- - [Database instrumentation](https://nitro.build/guide/database). --> |
| 28 | + <!-- - [KV Storage](https://nitro.build/guide/storage) and [Cache](https://nitro.build/guide/cache) instrumentation. --> |
| 29 | + |
| 30 | +## Manual Setup |
| 31 | + |
| 32 | +### 1. Prerequisites & Installation |
| 33 | + |
| 34 | +1. Install the Sentry Nitro SDK: |
| 35 | + |
| 36 | + ```bash |
| 37 | + # Using npm |
| 38 | + npm install @sentry/nitro |
| 39 | + |
| 40 | + # Using yarn |
| 41 | + yarn add @sentry/nitro |
| 42 | + |
| 43 | + # Using pnpm |
| 44 | + pnpm add @sentry/nitro |
| 45 | + ``` |
| 46 | + |
| 47 | +### 2. Nitro Config Setup |
| 48 | + |
| 49 | +1. Import `withSentryConfig` from `@sentry/nitro` and call it with your Nitro config. |
| 50 | + |
| 51 | +#### In `nitro.config.ts` |
| 52 | + |
| 53 | +If you are using a dedicated `nitro.config.ts` file, you can import `withSentryConfig` from `@sentry/nitro` and call it with your Nitro config. |
| 54 | + |
| 55 | +```javascript |
| 56 | +import { defineNitroConfig } from 'nitro/config'; |
| 57 | +import { withSentryConfig } from '@sentry/nitro'; |
| 58 | + |
| 59 | +const config = defineNitroConfig({ |
| 60 | + // ... |
| 61 | +}); |
| 62 | + |
| 63 | +export default withSentryConfig(config, { |
| 64 | + // Sentry Build Options |
| 65 | +}); |
| 66 | +``` |
| 67 | + |
| 68 | +#### In `vite.config.ts` |
| 69 | + |
| 70 | +If you are using nitro as a Vite plugin, you can import `withSentryConfig` from `@sentry/nitro` and call it with your Nitro config. |
| 71 | + |
| 72 | +```ts |
| 73 | +import { defineConfig } from 'vite'; |
| 74 | +import { nitro } from 'nitro/vite'; |
| 75 | +import { withSentryConfig } from '@sentry/nitro'; |
| 76 | + |
| 77 | +export default defineConfig({ |
| 78 | + plugins: [nitro()], |
| 79 | + nitro: withSentryConfig( |
| 80 | + { |
| 81 | + // Nitro options |
| 82 | + }, |
| 83 | + { |
| 84 | + // Sentry Build Options |
| 85 | + }, |
| 86 | + ), |
| 87 | +}); |
| 88 | +``` |
| 89 | + |
| 90 | +### 3. Sentry Config Setup |
| 91 | + |
| 92 | +TODO: UPDATE THIS |
| 93 | + |
| 94 | +## Uploading Source Maps |
| 95 | + |
| 96 | +To upload source maps... |
| 97 | + |
| 98 | +<!-- TODO: --> |
| 99 | + |
| 100 | +## Troubleshoot |
| 101 | + |
| 102 | +If you encounter any issues with error tracking or integrations, refer to the official [Sentry Nitro SDK documentation](https://docs.sentry.io/platforms/javascript/guides/nitro/). If the documentation does not provide the necessary information, consider opening an issue on GitHub. |
0 commit comments