Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@sentry/astro
Advanced tools
This SDK is experimental and in Alpha state. Breaking changes can occurr at any time. If you have feedback or encounter any bugs, feel free to open an issue.
This package is a wrapper around @sentry/node
for the server and @sentry/browser
for the client side.
Add the sentryAstro
integration to your astro.config.mjs
file:
import { sentryAstro } from "@sentry/astro/integration";
export default defineConfig({
// Rest of your Astro project config
integrations: [
sentryAstro({
dsn: '__DSN__',
}),
],
})
This is the easiest way to configure Sentry in an Astro project.
You can pass a few additional options to sentryAstro
but the SDK comes preconfigured in an opinionated way.
If you want to fully customize your SDK setup, you can do so, too:
To upload source maps to Sentry, simply add the project
and authToken
options to sentryAstro
:
// astro.config.mjs
import { sentryAstro } from "@sentry/astro/integration";
export default defineConfig({
// Rest of your Astro project config
integrations: [
sentryAstro({
dsn: '__DSN__',
project: 'your-project-slug',
authToken: import.meta.env('SENTRY_AUTH_TOKEN'),
}),
],
})
You can also define these values as environment variables in e.g. a .env
file
or in you CI configuration:
SENTRY_PROJECT="your-project"
SENTRY_AUTH_TOKEN="your-token"
Follow this guide to create an auth token.
To fully customize and configure Sentry in an Astro project, follow step 1 and in addition,
add a sentry.client.config.(js|ts)
and sentry.server.config(js|ts)
file to the root directory of your project.
Inside these files, you can call Sentry.init()
and use the full range of Sentry options.
Configuring the client SDK:
// sentry.client.config.ts or sentry.server.config.ts
import * as Sentry from "@sentry/astro";
Sentry.init({
dsn: "__DSN__",
beforeSend(event) {
console.log("Sending event on the client");
return event;
},
tracesSampler: () => {/* ... */}
});
Important: Once you created a sentry config file, the SDK options passed to sentryAstro
will be ignored for the respective runtime. You can also only define create of the two files.
If you want to move the sentry.*.config
files to another location,
you can specify the file path, relative to the project root, in sentryAstro
:
// astro.config.mjs
import { sentryAstro } from "@sentry/astro/integration";
export default defineConfig({
// Rest of your Astro project config
integrations: [
sentryAstro({
dsn: '__DSN__',
clientInitPath: '.config/sentry.client.init.js',
serverInitPath: '.config/sentry.server.init.js',
}),
],
})
FAQs
Official Sentry SDK for Astro
The npm package @sentry/astro receives a total of 11,203 weekly downloads. As such, @sentry/astro popularity was classified as popular.
We found that @sentry/astro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.