7.113.0 • Published 17 hours ago

@sentry/astro v7.113.0

Weekly downloads
-
License
MIT
Repository
github
Last release
17 hours ago

Official Sentry SDK for Astro

npm version npm dm npm dt

Links

SDK Status

This SDK is in Beta and not yet fully stable. If you have feedback or encounter any bugs, feel free to open an issue.

General

This package is a wrapper around @sentry/node for the server and @sentry/browser for the client side.

Installation and Setup

Install the Sentry Astro SDK with the astro CLI:

npx astro add @sentry/astro

Add your DSN and source maps upload configuration:

import { defineConfig } from "astro/config";
import sentry from "@sentry/astro";

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

Follow this guide to create an auth token and add it to your environment variables:

SENTRY_AUTH_TOKEN="your-token"

Server Instrumentation

For Astro apps configured for (hybrid) Server Side Rendering (SSR), the Sentry integration will automatically add middleware to your server to instrument incoming requests if you're using Astro 3.5.2 or newer.

If you're using Astro <3.5.2, complete the setup by adding the Sentry middleware to your src/middleware.js file:

// src/middleware.js
import { sequence } from "astro:middleware";
import * as Sentry from "@sentry/astro";

export const onRequest = sequence(
  Sentry.handleRequest(),
  // Add your other handlers after Sentry.handleRequest()
);

The Sentry middleware enhances the data collected by Sentry on the server side by:

  • Enabeling distributed tracing between client and server
  • Collecting performance spans for incoming requests
  • Enhancing captured errors with additional information

Disable Automatic Server Instrumentation

You can opt out of using the automatic sentry server instrumentation in your astro.config.mjs file:

import { defineConfig } from "astro/config";
import sentry from "@sentry/astro";

export default defineConfig({
  integrations: [
    sentry({
      dsn: "__DSN__",
      autoInstrumentation: {
        requestHandler: false,
      }
    }),
  ],
});

Configuration

Check out our docs for configuring your SDK setup:

7.113.0

17 hours ago

8.0.0-beta.5

3 days ago

7.112.2

9 days ago

8.0.0-beta.4

9 days ago

7.112.0

10 days ago

7.112.1

10 days ago

8.0.0-beta.3

14 days ago

7.111.0

15 days ago

8.0.0-beta.2

16 days ago

8.0.0-beta.1

18 days ago

7.110.1

18 days ago

7.110.0

22 days ago

8.0.0-alpha.9

25 days ago

8.0.0-alpha.8

25 days ago

7.109.0

1 month ago

8.0.0-alpha.7

1 month ago

8.0.0-alpha.5

1 month ago

7.108.0

1 month ago

8.0.0-alpha.4

2 months ago

7.107.0

2 months ago

7.106.1

2 months ago

7.106.0

2 months ago

8.0.0-alpha.2

2 months ago

7.105.0

2 months ago

7.104.0

2 months ago

7.103.0

2 months ago

7.102.1

2 months ago

7.102.0

2 months ago

7.101.1

3 months ago

7.101.0

3 months ago

7.100.1

3 months ago

7.100.0

3 months ago

7.99.0

3 months ago

7.97.0

3 months ago

7.98.0

3 months ago

7.95.0

3 months ago

7.94.1

3 months ago

7.93.0

4 months ago

7.92.0

4 months ago

7.91.0

4 months ago

7.90.0

4 months ago

7.89.0

5 months ago

7.88.0

5 months ago

7.87.0

5 months ago

7.86.0

5 months ago

7.85.0

5 months ago

7.84.0

5 months ago

7.83.0

5 months ago

7.82.0

5 months ago

7.81.1

5 months ago

7.81.0

5 months ago

7.80.2-alpha.1

6 months ago

7.80.2-alpha.0

6 months ago

7.80.1

6 months ago

7.80.0

6 months ago

7.79.0

6 months ago

7.78.0

6 months ago

7.77.0

6 months ago

7.76.0

6 months ago

7.75.1

6 months ago

7.75.0

6 months ago

7.74.2-alpha.1

6 months ago

7.74.1

7 months ago

7.74.0

7 months ago