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 and to node().

Required: pass a full Git commit SHA as release to the Vite plugin during vite build and to node() at process start. 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.

PlatformVariable
VercelVERCEL_GIT_COMMIT_SHA
RailwayRAILWAY_GIT_COMMIT_SHA
RenderRENDER_GIT_COMMIT
NetlifyCOMMIT_REF
Cloudflare PagesCF_PAGES_COMMIT_SHA
HerokuHEROKU_SLUG_COMMIT
Generic variablesGIT_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.

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.

RASPUTIN_RELEASE=fa1eade47b73733d6312d5abfad33ce9e4068081

Set RASPUTIN_PROJECT_API_KEY as a server secret and pass it to the Vite plugin and to node(). Never prefix it with PUBLIC_.

Tip: Set this up so every new deployment updates the SHA automatically. A fixed SHA will associate future errors with the wrong release.

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 sees it.

ARG RASPUTIN_RELEASE
ENV RASPUTIN_RELEASE=$RASPUTIN_RELEASE
RUN npm run build