triggerdotdev/trigger.dev

bug: TRIGGER_SECRET_KEY is being set to undefined when using Vite

Opened this issue · 2 comments

Provide environment information

  System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 184.53 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.3 - /opt/homebrew/bin/npm
    pnpm: 9.11.0 - /opt/homebrew/bin/pnpm

Describe the bug

Somehow my TRIGGER_SECRET_KEY is not getting passed through when using Vite.

Running:
import { TRIGGER_SECRET_KEY, TRIGGER_SECRET_KEYY, TRIGGER_API_URL } from '$env/static/private';

I get undefined, tr_dev_xyz, http://127.0.0.1:3040 which is strange. If I call the secret key TRIGGER_SECRET_KEYY instead of TRIGGER_SECRET_KEY it passes through no problem. I've grepped my codebase and I'm not doing anything with this environment variable anywhere.

Reproduction repo

n/a

To reproduce

Using SvelteKit to trigger a task, and Vite to load up my .env file.

Additional information

No response

A temporary work around is to use dotenv

// hooks.server.ts

import 'dotenv/config'

Do you have a reproduction available? @Woolworths I can take a look if so, as it's SvelteKit related