Astro with AllStak
Add error tracking and SSR request monitoring to your Astro site with the AllStak Astro integration.
- Source repository:
- AllStak/allstak-astro
- Source README:
- README.md
- SDK version:
- 0.1.1
- Installation source:
- npm
- Last verified:
- 2026-05-31
Installation
Install from npm (requires astro@>=3.5).
npm install @allstak/astroConfiguration
Add the integration in astro.config.mjs.
import { defineConfig } from 'astro/config';
import allstak from '@allstak/astro';
export default defineConfig({
integrations: [
allstak({
apiKey: process.env.ALLSTAK_API_KEY,
environment: process.env.NODE_ENV,
release: process.env.npm_package_version,
}),
],
});Basic example
Capture errors in frontmatter or server code via the AllStak namespace.
---
import { AllStak } from '@allstak/astro';
try {
await loadDashboard();
} catch (err) {
AllStak.captureException(err, { page: 'dashboard' });
throw err;
}
---Capturing errors
In SSR output, server render errors are captured automatically by the integration's middleware; capture manually with AllStak.captureException.
Tracking requests
In server (SSR) output, the middleware wraps each request in an http.server span recording method, route, and status. Static output has no request pipeline, so there is nothing to instrument.
Best practices
- Set ALLSTAK_API_KEY in the environment.
- autoInstrumentServer (default true) covers SSR request monitoring.
- Set release to group errors per deploy.