1.2.55 • Published 10 months ago

@jill64/sentry-sveltekit-edge v1.2.55

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@jill64/sentry-sveltekit-edge

♟️ Unofficial Sentry integration for SvelteKit edge runtime

Installation

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.

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.

// 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

// 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

// 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.

Example

// 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

1.2.53

10 months ago

1.2.54

10 months ago

1.2.55

10 months ago

1.2.41

11 months ago

1.2.42

11 months ago

1.2.40

12 months ago

1.2.45

11 months ago

1.2.46

11 months ago

1.2.43

11 months ago

1.2.44

11 months ago

1.2.49

10 months ago

1.2.47

11 months ago

1.2.48

11 months ago

1.2.52

10 months ago

1.2.50

10 months ago

1.2.51

10 months ago

1.2.30

1 year ago

1.2.31

1 year ago

1.2.34

1 year ago

1.2.35

1 year ago

1.2.32

1 year ago

1.2.33

1 year ago

1.2.38

12 months ago

1.2.39

12 months ago

1.2.36

1 year ago

1.2.37

12 months ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.2.17

1 year ago

1.2.16

1 year ago

1.2.15

1 year ago

1.2.12

1 year ago

1.2.13

1 year ago

1.2.14

1 year ago

1.2.10

1 year ago

1.2.11

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

2 years ago

1.1.4

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago