Skip to content

Commit 0800742

Browse files
nicohrubeccodex
andauthored
docs(astro): Point README to SDK documentation (#24626)
similar to #24618 but for @sentry/astro --------- Co-authored-by: GPT-6 <codex@openai.com>
1 parent c12f814 commit 0800742

1 file changed

Lines changed: 7 additions & 127 deletions

File tree

‎packages/astro/README.md‎

Lines changed: 7 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -10,137 +10,17 @@
1010
[![npm dm](https://img.shields.io/npm/dm/@sentry/astro.svg)](https://www.npmjs.com/package/@sentry/astro)
1111
[![npm dt](https://img.shields.io/npm/dt/@sentry/astro.svg)](https://www.npmjs.com/package/@sentry/astro)
1212

13-
## Links
14-
15-
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/astro/)
16-
17-
## SDK Status
13+
The official Sentry SDK for monitoring Astro applications.
1814

1915
This SDK is in Beta and not yet fully stable. If you have feedback or encounter any bugs, feel free to
2016
[open an issue](https://github.com/getsentry/sentry-javascript/issues/new/choose).
2117

22-
## General
23-
24-
This package is a wrapper around `@sentry/node` for the server and `@sentry/browser` for the client side.
25-
26-
## Installation and Setup
27-
28-
Install the Sentry Astro SDK with the `astro` CLI:
29-
30-
```bash
31-
npx astro add @sentry/astro
32-
```
33-
34-
### Build-time Configuration
35-
36-
Register the Sentry integration in your `astro.config.mjs`. This is where you configure build-time options such as
37-
source maps upload (`org`, `project`, `authToken`). Runtime SDK options (`dsn`, `environment`, `tracesSampleRate`, Replay
38-
sample rates, and so on) belong in dedicated init files, not on `sentry()`.
39-
40-
```javascript
41-
import { defineConfig } from 'astro/config';
42-
import sentry from '@sentry/astro';
43-
44-
export default defineConfig({
45-
integrations: [
46-
sentry({
47-
org: 'your-org-slug',
48-
project: 'your-sentry-project-slug',
49-
authToken: process.env.SENTRY_AUTH_TOKEN,
50-
}),
51-
],
52-
});
53-
```
54-
55-
Follow [this guide](https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens) to create an auth
56-
token and add it to your environment variables:
57-
58-
```bash
59-
SENTRY_AUTH_TOKEN="your-token"
60-
```
61-
62-
### Runtime SDK Configuration
63-
64-
If you do not add `sentry.client.config.ts` or `sentry.server.config.ts`, Sentry still initializes with default options
65-
and reads the DSN from `PUBLIC_SENTRY_DSN`. Add those files at the project root when you want to customize client or
66-
server options, and pass them to `Sentry.init()`.
67-
68-
Set `PUBLIC_SENTRY_DSN` in your environment (for example in `.env`):
69-
70-
```bash
71-
PUBLIC_SENTRY_DSN="__DSN__"
72-
```
73-
74-
```javascript
75-
// sentry.client.config.ts
76-
import * as Sentry from '@sentry/astro';
77-
78-
Sentry.init({
79-
dsn: '__DSN__',
80-
tracesSampleRate: 1.0,
81-
integrations: [Sentry.replayIntegration()],
82-
replaysSessionSampleRate: 0.1,
83-
replaysOnErrorSampleRate: 1.0,
84-
});
85-
```
86-
87-
```javascript
88-
// sentry.server.config.ts
89-
import * as Sentry from '@sentry/astro';
90-
91-
Sentry.init({
92-
dsn: '__DSN__',
93-
tracesSampleRate: 1.0,
94-
});
95-
```
96-
97-
### Server Instrumentation
98-
99-
For Astro apps configured for (hybrid) Server Side Rendering (SSR), the Sentry integration will automatically add
100-
middleware to your server to instrument incoming requests.
101-
102-
The Sentry middleware enhances the data collected by Sentry on the server side by:
103-
104-
- Enabling distributed tracing between client and server
105-
- Collecting performance spans for incoming requests
106-
- Enhancing captured errors with additional information
107-
108-
#### Disable Automatic Server Instrumentation
109-
110-
You can opt out of using the automatic sentry server instrumentation in your `astro.config.mjs` file:
111-
112-
```javascript
113-
import { defineConfig } from 'astro/config';
114-
import sentry from '@sentry/astro';
115-
116-
export default defineConfig({
117-
integrations: [
118-
sentry({
119-
autoInstrumentation: {
120-
requestHandler: false,
121-
},
122-
}),
123-
],
124-
});
125-
```
126-
127-
If you opt out but still want the middleware, add it manually to your `src/middleware.js` file:
128-
129-
```javascript
130-
// src/middleware.js
131-
import { sequence } from 'astro:middleware';
132-
import * as Sentry from '@sentry/astro';
133-
134-
export const onRequest = sequence(
135-
Sentry.handleRequest(),
136-
// Add your other handlers after Sentry.handleRequest()
137-
);
138-
```
18+
## Documentation
13919

140-
## Configuration
20+
- [Getting started](https://docs.sentry.io/platforms/javascript/guides/astro/)
21+
- [Configuration](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/)
14122

142-
Check out our docs for configuring your SDK setup:
23+
## Support
14324

144-
- [Getting Started](https://docs.sentry.io/platforms/javascript/guides/astro/)
145-
- [Manual Setup and Configuration](https://docs.sentry.io/platforms/javascript/guides/astro/manual-setup/)
146-
- [Source Maps Upload](https://docs.sentry.io/platforms/javascript/guides/astro/sourcemaps/)
25+
- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose)
26+
- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md)

0 commit comments

Comments
 (0)