Skip to main content
Sentry supports a wide range of JavaScript frameworks and runtimes beyond the major ones. This guide covers installation for additional platforms.

Available Packages

The Sentry JavaScript SDK provides packages for many frameworks and runtimes:
  • Astro: @sentry/astro
  • Solid: @sentry/solid
  • SolidStart: @sentry/solidstart
  • Ember: @sentry/ember
  • Gatsby: @sentry/gatsby
  • Bun: @sentry/bun
  • Deno: @sentry/deno
  • Cloudflare Workers: @sentry/cloudflare
  • Vercel Edge: @sentry/vercel-edge
  • AWS Lambda: @sentry/aws-serverless
  • Google Cloud Functions: @sentry/google-cloud-serverless

Astro

Installation

npm install @sentry/astro

Configuration

// astro.config.mjs
import { defineConfig } from 'astro/config';
import sentry from '@sentry/astro';

export default defineConfig({
  integrations: [
    sentry({
      dsn: 'YOUR_DSN_HERE',
      sourceMapsUploadOptions: {
        org: 'your-org',
        project: 'your-project',
        authToken: process.env.SENTRY_AUTH_TOKEN,
      },
    }),
  ],
});

Usage

---
import * as Sentry from '@sentry/astro';

try {
  const data = await fetchData();
} catch (error) {
  Sentry.captureException(error);
}
---

<div>{data.title}</div>

Solid

Installation

npm install @sentry/solid

Configuration

import { render } from 'solid-js/web';
import * as Sentry from '@sentry/solid';
import App from './App';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  
  integrations: [
    Sentry.browserTracingIntegration(),
  ],
  
  tracesSampleRate: 1.0,
});

render(() => <App />, document.getElementById('root'));

Error Boundary

import { ErrorBoundary } from '@sentry/solid';

function App() {
  return (
    <ErrorBoundary fallback={(err) => <div>Error: {err.message}</div>}>
      <YourApp />
    </ErrorBoundary>
  );
}

SolidStart

Installation

npm install @sentry/solidstart

Client Configuration

// entry-client.tsx
import { mount, StartClient } from '@solidjs/start/client';
import * as Sentry from '@sentry/solidstart';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

mount(() => <StartClient />, document.getElementById('app')!);

Server Configuration

// entry-server.tsx
import { createHandler, StartServer } from '@solidjs/start/server';
import * as Sentry from '@sentry/solidstart';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

export default createHandler(() => (
  <StartServer
    document={({ assets, children, scripts }) => (
      <html lang="en">
        <head>{assets}</head>
        <body>
          {children}
          {scripts}
        </body>
      </html>
    )}
  />
));

Bun

Installation

bun add @sentry/bun

Configuration

import * as Sentry from '@sentry/bun';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

// Your Bun application code
const server = Bun.serve({
  port: 3000,
  fetch(req) {
    try {
      return new Response('Hello World');
    } catch (error) {
      Sentry.captureException(error);
      return new Response('Error', { status: 500 });
    }
  },
});

Deno

Installation

Import directly from deno.land:
import * as Sentry from 'https://deno.land/x/sentry/index.mjs';
Or use npm specifier:
import * as Sentry from 'npm:@sentry/deno';

Configuration

import * as Sentry from 'npm:@sentry/deno';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

Deno.serve((req) => {
  try {
    return new Response('Hello World');
  } catch (error) {
    Sentry.captureException(error);
    return new Response('Error', { status: 500 });
  }
});

Cloudflare Workers

Installation

npm install @sentry/cloudflare

Configuration

import * as Sentry from '@sentry/cloudflare';

export interface Env {
  SENTRY_DSN: string;
}

export default {
  async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
    Sentry.init({
      dsn: env.SENTRY_DSN,
      tracesSampleRate: 1.0,
    });
    
    try {
      return new Response('Hello World');
    } catch (error) {
      Sentry.captureException(error);
      return new Response('Error', { status: 500 });
    }
  },
};

With Hono

import { Hono } from 'hono';
import * as Sentry from '@sentry/cloudflare';

const app = new Hono();

app.use('*', async (c, next) => {
  Sentry.init({
    dsn: c.env.SENTRY_DSN,
    tracesSampleRate: 1.0,
  });
  
  await next();
});

app.get('/', (c) => {
  return c.text('Hello World');
});

export default app;

AWS Lambda

Installation

npm install @sentry/aws-serverless

Configuration

import * as Sentry from '@sentry/aws-serverless';
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

export const handler = Sentry.wrapHandler(
  async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
    try {
      // Your Lambda code
      return {
        statusCode: 200,
        body: JSON.stringify({ message: 'Success' }),
      };
    } catch (error) {
      Sentry.captureException(error);
      throw error;
    }
  }
);

Google Cloud Functions

Installation

npm install @sentry/google-cloud-serverless

Configuration

import * as Sentry from '@sentry/google-cloud-serverless';
import type { HttpFunction } from '@google-cloud/functions-framework';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

export const helloWorld: HttpFunction = Sentry.wrapHttpFunction(
  (req, res) => {
    try {
      res.send('Hello World');
    } catch (error) {
      Sentry.captureException(error);
      res.status(500).send('Error');
    }
  }
);

Ember

Installation

npm install @sentry/ember

Configuration

// app/instance-initializers/sentry.js
import * as Sentry from '@sentry/ember';

export function initialize() {
  Sentry.init({
    dsn: 'YOUR_DSN_HERE',
    tracesSampleRate: 1.0,
  });
}

export default {
  initialize,
};

Gatsby

Installation

npm install @sentry/gatsby

Configuration

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: '@sentry/gatsby',
      options: {
        dsn: 'YOUR_DSN_HERE',
        tracesSampleRate: 1.0,
        sampleRate: 1.0,
      },
    },
  ],
};

Generic JavaScript

For frameworks not listed here, you can use the base browser or Node.js SDK:

Browser

npm install @sentry/browser
import * as Sentry from '@sentry/browser';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

Node.js

npm install @sentry/node
import * as Sentry from '@sentry/node';

Sentry.init({
  dsn: 'YOUR_DSN_HERE',
  tracesSampleRate: 1.0,
});

Common Patterns

Capturing Errors

All SDKs share the same API for capturing errors:
import * as Sentry from '@sentry/<package>';

try {
  someFunctionThatMightFail();
} catch (error) {
  Sentry.captureException(error);
}

Setting Context

// Set user
Sentry.setUser({ id: '123', email: '[email protected]' });

// Set tags
Sentry.setTag('environment', 'production');

// Set extra context
Sentry.setExtra('metadata', { key: 'value' });

Performance Monitoring

const result = await Sentry.startSpan(
  { name: 'my-operation', op: 'function' },
  async () => {
    return await myExpensiveOperation();
  }
);

Framework-Specific Documentation

For detailed documentation on each framework:

Need Help?

If your framework isn’t listed:
  1. Check the official Sentry documentation
  2. Use the base @sentry/browser or @sentry/node SDK
  3. Reach out on the Sentry Discord
  4. Search Stack Overflow

Next Steps

Build docs developers (and LLMs) love