Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jill64/sentry-sveltekit-edge
♟️ Unofficial Sentry integration for SvelteKit edge runtime
https://github.com/jill64/sentry-sveltekit-edge
edge sentry sveltekit vercel
Last synced: 6 days ago
JSON representation
♟️ Unofficial Sentry integration for SvelteKit edge runtime
- Host: GitHub
- URL: https://github.com/jill64/sentry-sveltekit-edge
- Owner: jill64
- License: mit
- Created: 2023-11-16T09:45:32.000Z (almost 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-21T22:42:35.000Z (6 months ago)
- Last Synced: 2024-05-22T21:57:04.185Z (6 months ago)
- Topics: edge, sentry, sveltekit, vercel
- Language: TypeScript
- Homepage: https://npmjs.com/package/@jill64/sentry-sveltekit-edge
- Size: 853 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @jill64/sentry-sveltekit-edge
♟️ Unofficial Sentry integration for SvelteKit edge runtime
## Installation
```sh
npm i @jill64/sentry-sveltekit-edge
```## Requirements
- Any edge runtime that supports `fetch`
> [!NOTE]
> If running on `Cloudflare Pages`, use instead [`@jill64/sentry-sveltekit-cloudflare`](https://github.com/jill64/sentry-sveltekit-cloudflare).## Limitations
This library is `@sentry/sveltekit` without the node runtime dependencies.
### Available
- All features for client
- Basic error capture on server### Unavailable
- Default integrations
- Auto session tracking## Configuration
Add the following settings to your SvelteKit application's `vite.config.js`.
```js
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'export default defineConfig({
plugins: [sveltekit()],
ssr: {
noExternal: ['@jill64/sentry-sveltekit-edge']
}
// ...
})
```## Usage
### Client
```js
// hooks.client.js
import { init } from '@jill64/sentry-sveltekit-edge/client'
// or
// import { clientInit } from '@jill64/sentry-sveltekit-edge'const onError = init(
'__YOUR_SENTRY_DSN__'
// ,
// {
// sentryOptions: {
// // ... Other Sentry Config
// },
// enableInDevMode: boolean (default: false)
// }
)export const handleError = onError((e) => {
// Your Error Handler
})
```### Server
```js
// hooks.server.js
import { init } from '@jill64/sentry-sveltekit-edge/server'
// or
// import { serverInit } from '@jill64/sentry-sveltekit-edge'const { onHandle, onError } = serverInit(
'__YOUR_SENTRY_DSN__'
// ,
// {
// sentryOptions?: {
// // ... Other Sentry Config (Based on NodeOptions)
// },
// handleOptions?: {
// handleUnknownRoutes: boolean (default: false)
// },
// enableInDevMode?: boolean (default: false)
// }
)export const handle = onHandle(({ event, resolve }) => {
// Your Handle Code
})export const handleError = onError((e) => {
// Your Error Handler
})
```## Configure Source Map (Optional)
Use [@sentry/vite-plugin](https://npmjs.com/package/@sentry/vite-plugin).
### Example
```js
// vite.config.js
import { sentryVitePlugin } from '@sentry/vite-plugin'
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'export default defineConfig({
build: {
sourcemap: true
},
plugins: [
sentryVitePlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN
}),
sveltekit()
]
})
```## License
[MIT](LICENSE)