Environment variables
Every environment variable the JavaScript SDK, Python SDK and CLI read: name, purpose, whether it is required, default, whether it is secret and where it applies.
The SDKs and the CLI can take their settings from the environment. Explicit arguments always win over environment variables.
SDKs (JavaScript and Python)
| Variable | Purpose | Required | Secret | Where |
|---|---|---|---|---|
SOVARIA_URL | The project URL, https://<project-ref>.sovarias.in. | Yes (or one of the two below) | No | Servers, functions, CI |
NEXT_PUBLIC_SOVARIA_URL | Same, exposed to Next.js browser code. | — | No | Next.js |
VITE_SOVARIA_URL | Same, exposed to Vite browser code. | — | No | Vite apps |
SOVARIA_ANON_KEY | The anon key. | For client-style use | No | Anywhere |
VITE_SOVARIA_ANON_KEY | The anon key for Vite browser code (read by createClientFromProjectConfig). | — | No | Vite apps |
SOVARIA_PUBLISHABLE_KEY | Alias for the anon key. | — | No | Anywhere |
SOVARIA_ACCESS_TOKEN | A token or server key to call as. Takes precedence over the anon key. | For server use | Yes | Servers, CI only |
SOVARIA_EXPIRES_IN | Seconds until SOVARIA_ACCESS_TOKEN expires, if it is a session token. | No | No | Servers |
SOVARIA_ORG_ID, SOVARIA_PROJECT_ID | Pin the organization and project (normally discovered from the URL). | No | No | Multi-project tools |
SOVARIA_ENV_ID | Call an environment other than production. | No | No | Staging, previews |
import { SovariaSDK } from '@sovaria/sdk'
const sovaria = SovariaSDK.fromEnv(process.env) // SOVARIA_URL + SOVARIA_ACCESS_TOKEN or SOVARIA_ANON_KEYCLI
| Variable | Purpose | Secret |
|---|---|---|
SOVARIA_API_KEY | A project key to authenticate with in CI (instead of sov login). Wins over stored logins. | Yes |
SOVARIA_ACCESS_TOKEN | A token to authenticate with. Wins over SOVARIA_API_KEY and stored logins. | Yes |
SOVARIA_PASSWORD | Password for non-interactive sov login --email <email>. | Yes |
SOVARIA_GITHUB_TOKEN | GitHub token for deploying functions from a repository (otherwise gh auth token is used). | Yes |
SOV_JSON=1 | Print raw JSON instead of tables (same as --json). | No |
SOV_DEBUG=1 | Show full error traces. | No |
The CLI also reads sovaria.config.json (written by sov link / sov init) for the current folder's project, and ~/.sovaria/config.yaml for named profiles. Which project: flags first, then sovaria.config.json, then the scope set with sov scope set. Which credentials: SOVARIA_ACCESS_TOKEN, then SOVARIA_API_KEY, then the stored sov login.
Inside functions
Functions read the secrets and variables you bind to them from their environment at run time (Functions). Store values per environment so staging never uses production keys.
Troubleshooting
| Message | Cause |
|---|---|
Missing SOVARIA_URL (or NEXT_PUBLIC_SOVARIA_URL / VITE_SOVARIA_URL) | The variable isn't set in the process that runs your code (check your hosting provider's settings and restart). |
401 on every request | Wrong project's key, a revoked key, or an expired SOVARIA_ACCESS_TOKEN. |
Warning: SOVARIA_PUBLISHABLE_KEY looks like a user JWT | A session token was put where the anon key belongs; use SOVARIA_ACCESS_TOKEN for tokens. |
Browser code shows undefined | Bundlers only expose prefixed variables (VITE_, NEXT_PUBLIC_), and only at build time — rebuild after changing them. |