From 890c835ce404b1d9f84389638fcef6eb71e904bf Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Thu, 8 Jan 2026 11:11:15 +0100 Subject: [PATCH] Use Netlify's auto-provided SITE_ID instead of custom env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace NETLIFY_BLOBS_SITE_ID with SITE_ID which is automatically provided by Netlify during builds, reducing required configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/data-layer/docs.md | 6 +++--- src/data-layer/storage/netlifyBlobsStorage.ts | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/data-layer/docs.md b/src/data-layer/docs.md index 907b4a8b5c8..66334f35322 100644 --- a/src/data-layer/docs.md +++ b/src/data-layer/docs.md @@ -129,7 +129,7 @@ export interface Storage { - `setData(taskId, data)` - Store data with automatic metadata **Storage Configuration:** -- Requires `NETLIFY_BLOBS_SITE_ID` and `NETLIFY_BLOBS_TOKEN` environment variables +- Requires `SITE_ID` (auto-provided by Netlify) and `NETLIFY_BLOBS_TOKEN` environment variables - Throws error if credentials are missing (no silent fallback) - Use `USE_MOCK_DATA=true` for local development @@ -276,7 +276,7 @@ See `tests/unit/data-layer/getters.spec.ts` for test examples. ## Environment Variables **Required for production:** -- `NETLIFY_BLOBS_SITE_ID` - Netlify Blobs site ID (required, throws error if missing) +- `SITE_ID` - Netlify site ID (auto-provided by Netlify during builds) - `NETLIFY_BLOBS_TOKEN` - Netlify Blobs access token (required, throws error if missing) - `TRIGGER_PROJECT_ID` - Trigger.dev project ID @@ -319,7 +319,7 @@ This pulls data from Netlify Blobs storage and saves it as JSON files for local - Regenerate mocks if needed: `npm run generate-mocks` (if script exists) ### Netlify Blobs errors -- Verify `NETLIFY_BLOBS_SITE_ID` and `NETLIFY_BLOBS_TOKEN` are set +- Verify `SITE_ID` (auto-provided by Netlify) and `NETLIFY_BLOBS_TOKEN` are set - Check error message for specific configuration issues - Storage will throw clear error if credentials are missing diff --git a/src/data-layer/storage/netlifyBlobsStorage.ts b/src/data-layer/storage/netlifyBlobsStorage.ts index 6a391ca5bb7..dc4642abf20 100644 --- a/src/data-layer/storage/netlifyBlobsStorage.ts +++ b/src/data-layer/storage/netlifyBlobsStorage.ts @@ -7,13 +7,12 @@ let store: ReturnType | null = null function getBlobStore() { if (store) return store - const siteID = process.env.NETLIFY_BLOBS_SITE_ID + // SITE_ID is automatically provided by Netlify during builds + const siteID = process.env.SITE_ID const token = process.env.NETLIFY_BLOBS_TOKEN if (!siteID || !token) { - throw new Error( - "Missing NETLIFY_BLOBS_SITE_ID or NETLIFY_BLOBS_TOKEN env vars" - ) + throw new Error("Missing SITE_ID or NETLIFY_BLOBS_TOKEN env vars") } store = getStore({