Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jill64/sentry-sveltekit-edge

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jill64/sentry-sveltekit-edge

♟️ Unofficial Sentry Integration for SvelteKit with any edge runtime

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-80.65%
Maintainers
1
Weekly downloads
 
Created
Source

sentry-sveltekit-edge

npm-version npm-license npm-download-month npm-min-size ci.yml

♟️ Unofficial Sentry Integration for SvelteKit with any edge runtime

Installation

npm i @jill64/sentry-sveltekit-edge

[!INFO] If running on cloudflare pages, use instead @jill64/sentry-sveltekit-cloudflare.

Confirmed Adapters

  • adapter-vercel
  • adapter-netlify
  • adapter-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 { clientInit } from '@jill64/sentry-sveltekit-edge'

const onError = clientInit(
  '__YOUR_SENTRY_DSN__'
  // ,
  // {
  //   sentryOptions: {
  //     // ... Other Sentry Config
  //   },
  //   enableInDevMode: boolean (default: false)
  // }
)

export const handleError = onError((e) => {
  // Your Error Handler
})

Server

// hooks.server.js
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()
  ]
})

Keywords

FAQs

Package last updated on 17 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc