Configure releases
Make the git commit SHA available when Vite builds the app and when the Node adapter starts.
Pass that same SHA to the plugin, to node(), and to client hooks.
Required: pass a full Git commit SHA as release to the Vite plugin during vite build, to node() at process start, and as PUBLIC_RASPUTIN_RELEASE for client hooks. If you
omit it, the SDK does not send events. The project API key stays on the server.
Platform variables
If you build or run on one of these platforms, pass that platform's variable as release instead of setting RASPUTIN_RELEASE. Rasputin does not read these
variables for you. The Vite plugin reads the value during vite build. node() reads it from the process environment.
| Platform | Variable |
|---|---|
| Vercel | VERCEL_GIT_COMMIT_SHA |
| Railway | RAILWAY_GIT_COMMIT_SHA |
| Render | RENDER_GIT_COMMIT |
| Netlify | COMMIT_REF |
| Cloudflare Pages | CF_PAGES_COMMIT_SHA |
| Heroku | HEROKU_SLUG_COMMIT |
| Generic variables | GIT_COMMIT, COMMIT_SHA, or GIT_SHA |
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { rasputin } from '@rasputin-ai/sveltekit/vite';
export default defineConfig(({ command }) => ({
plugins: [
rasputin({
enabled: command === 'build',
release: process.env.VERCEL_GIT_COMMIT_SHA!,
projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY,
}),
sveltekit(),
],
}));Pass the same SHA to the server runtime. A PUBLIC_ variable such as PUBLIC_RASPUTIN_RELEASE is inlined into client
hooks at build time.
node({
dsn: process.env.RASPUTIN_DSN!,
projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY!,
environment: 'production',
release: process.env.VERCEL_GIT_COMMIT_SHA!,
});Manual configuration
If your host is not listed above, set RASPUTIN_RELEASE to the full commit SHA during the
build and on the running Node process. Set PUBLIC_RASPUTIN_RELEASE to the same SHA for client
hooks.
RASPUTIN_RELEASE=fa1eade47b73733d6312d5abfad33ce9e4068081
PUBLIC_RASPUTIN_RELEASE=fa1eade47b73733d6312d5abfad33ce9e4068081Set RASPUTIN_PROJECT_API_KEY as a server secret and
pass it only to node(). Never prefix it with PUBLIC_ and never put it in hooks.client.ts.
Example with Fly.io
Fly usually runs vite build inside Docker and then
starts the Node adapter. The SHA has to be present in that image build and as a runtime env on
the machine.
Deploying from your machine
fly deploy --build-arg RASPUTIN_RELEASE="$(git rev-parse HEAD)" --env RASPUTIN_RELEASE="$(git rev-parse HEAD)"Deploying with GitHub Actions
- name: Deploy
run: flyctl deploy --build-arg RASPUTIN_RELEASE="$GITHUB_SHA" --env RASPUTIN_RELEASE="$GITHUB_SHA"Copy the build argument into the environment before vite build so the plugin and PUBLIC_RASPUTIN_RELEASE see it.
ARG RASPUTIN_RELEASE
ENV RASPUTIN_RELEASE=$RASPUTIN_RELEASE
ENV PUBLIC_RASPUTIN_RELEASE=$RASPUTIN_RELEASE
RUN npm run build