Configure builds

Make the git commit SHA and project API key available when Vite builds the app. You still pass that same SHA to RasputinInit.

Required: pass a full Git commit SHA as release during vite build, to the plugin and to RasputinInit. If you omit it, the SDK does not send events. The plugin also needs the project API key to upload debug data so errors can be matched to your source. A missing key skips upload; the build still succeeds.

Platform variables

If you build 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.

PlatformBuild variable
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 { rasputin } from '@rasputin-ai/browser/vite';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [
    rasputin({
      release: process.env.VERCEL_GIT_COMMIT_SHA!,
      projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY,
    }),
  ],
});

Pass the same SHA to RasputinInit. A VITE_ variable such as VITE_RASPUTIN_RELEASE is inlined at build time. Setting a SHA only on the running CDN or static host does not reach Vite.

Manual configuration

If your build host is not listed above, set RASPUTIN_RELEASE to the full commit SHA during the build and pass it as release. Set VITE_RASPUTIN_RELEASE to the same SHA for RasputinInit. Both must be available while vite build runs.

RASPUTIN_RELEASE=fa1eade47b73733d6312d5abfad33ce9e4068081

Set RASPUTIN_PROJECT_API_KEY as a build secret and pass it only to the Vite plugin. Never prefix it with VITE_ and never put it in frontend code.

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

Example with Fly.io

If you deploy with Fly, vite build usually runs inside Docker. The SHA has to be present in that image build. Choose the example that matches how you launch the deploy.

Deploying from your machine

fly deploy --build-arg RASPUTIN_RELEASE="$(git rev-parse HEAD)"

Deploying with GitHub Actions

- name: Deploy
  run: flyctl deploy --build-arg RASPUTIN_RELEASE="$GITHUB_SHA"

Copy the build argument into the environment before vite build. The project API key must also be available during that build. Do not prefix it with VITE_.

ARG RASPUTIN_RELEASE
ENV RASPUTIN_RELEASE=$RASPUTIN_RELEASE
ENV VITE_RASPUTIN_RELEASE=$RASPUTIN_RELEASE
RUN npm run build

Do not pass the SHA only as a Fly secret or --env on the running machine. Those values never reach the Vite plugin.