feat(buildExtensions): syncSupabaseEnvVars build extension#3152
feat(buildExtensions): syncSupabaseEnvVars build extension#3152
Conversation
0ski
commented
Feb 27, 2026
- docs
|
WalkthroughThis PR introduces a new Supabase environment variable synchronization extension. Changes include: (1) documentation updates to overview.mdx listing the new extension and a detailed configuration page (syncEnvVars.mdx) with setup instructions, environment variables, and usage examples; (2) a new TypeScript implementation file (syncSupabaseEnvVars.ts) that exports a BuildExtension for fetching Supabase branch data and API keys, mapping them to standard environment variables with optional prefix support, and comprehensive error handling; (3) a public re-export in the extensions core API. No modifications to existing functional logic. Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
docs/config/extensions/syncEnvVars.mdx (1)
242-246: Clarify "preview/staging" language for consistency.The note says the extension is skipped for
prodanddevenvironments and is for "preview/staging environments," but the code only checks forprodanddevby name. Consider clarifying that this means any environment name other than "prod" or "dev" will trigger the sync, to avoid confusion about whether a literal "staging" environment is required.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/config/extensions/syncEnvVars.mdx` around lines 242 - 246, Update the Note text in the syncEnvVars extension documentation to clarify that the extension is skipped only when the environment name is exactly "prod" or "dev" and that it will run for any other environment name (i.e., any environment name other than "prod" or "dev" will trigger the sync), replacing the ambiguous phrase "preview/staging environments" in the Note block so readers understand a literal "staging" name is not required.packages/build/src/extensions/core/syncSupabaseEnvVars.ts (3)
193-204: Hardcoded database name"postgres"may not work for all setups.The database name is hardcoded to
"postgres"(line 199). While this is the default for Supabase, consider making it configurable via options for users with custom database names, similar to howsyncNeonEnvVarsoffers adatabaseNameoption.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/build/src/extensions/core/syncSupabaseEnvVars.ts` around lines 193 - 204, The code hardcodes the DB name "postgres" when calling buildSupabaseEnvVarMappings; make the DB name configurable by adding a databaseName option (with default "postgres") to the syncSupabaseEnvVars options and pass that option instead of the literal string. Update the call to buildSupabaseEnvVarMappings to use the new databaseName variable, and adjust the function signature/usage of syncSupabaseEnvVars and any callers to accept/forward databaseName (mirror the pattern used by syncNeonEnvVars) so custom Supabase projects can override the default.
187-191: Silent failure on API keys fetch may hide issues.If fetching API keys fails (non-ok response), the extension silently proceeds without
anonKeyandserviceRoleKey. Users may not realize these critical keys are missing. Consider logging a warning when the API keys request fails.Proposed enhancement
- if (apiKeysResponse.ok) { + if (!apiKeysResponse.ok) { + console.warn( + `syncSupabaseEnvVars: Failed to fetch API keys (${apiKeysResponse.status}). SUPABASE_ANON_KEY and SUPABASE_SERVICE_ROLE_KEY will not be synced.` + ); + } else { const apiKeys: SupabaseApiKey[] = await apiKeysResponse.json(); anonKey = apiKeys.find((k) => k.name === "anon")?.api_key; serviceRoleKey = apiKeys.find((k) => k.name === "service_role")?.api_key; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/build/src/extensions/core/syncSupabaseEnvVars.ts` around lines 187 - 191, The code silently ignores a failed API keys fetch (apiKeysResponse) and may leave anonKey and serviceRoleKey unset; update the logic in syncSupabaseEnvVars (around the apiKeysResponse handling) to detect when apiKeysResponse.ok is false and emit a clear warning or error via the existing logger (e.g., processLogger or logger used in this module) indicating the API keys request failed and keys may be missing, include response.status and response.statusText (or response.text()) in the message, and keep the current behavior of setting anonKey/serviceRoleKey only when apiKeysResponse.ok is true.
144-166: Consider logging when no matching branch is found.Silently returning an empty array when no matching Supabase branch is found (line 165) could make debugging difficult for users who expect env vars to be synced. A debug log or warning would help users understand why variables weren't synced.
Proposed enhancement
const matchingBranch = branches.find( (b) => b.git_branch === branch || b.name === branch ); if (!matchingBranch) { // No matching branch found + console.warn(`syncSupabaseEnvVars: No Supabase branch found matching "${branch}". Skipping env var sync.`); return []; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/build/src/extensions/core/syncSupabaseEnvVars.ts` around lines 144 - 166, When no Supabase branch matches the requested branch the code currently returns an empty array silently; add a log message right before the early return in syncSupabaseEnvVars (the block that checks matchingBranch after branches.find) to record the requested branch and projectId (use the existing logger/processLogger used in this module) at warn or debug level so users can see why env vars weren't synced; ensure the log precedes the return [] and includes identifying data (branch, projectId, and possibly the list of available branch names) to aid debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/build/src/extensions/core.ts`:
- Line 8: Add a changeset for the public package `@trigger.dev/build` to record
the re-export change; run the command `pnpm run changeset:add` and create a
changeset entry describing the export of "./core/syncSupabaseEnvVars.js" from
packages/build/src/extensions/core.ts so the package version and changelog are
updated accordingly.
In `@packages/build/src/extensions/core/syncSupabaseEnvVars.ts`:
- Around line 124-138: The branch-missing error is raised before we skip for
dev, causing false errors when ctx.environment === "dev"; update the logic in
syncSupabaseEnvVars (the function using ctx.environment and branch) to check if
ctx.environment === "dev" and return [] before performing the branch validation,
so the branch-null throw ("syncSupabaseEnvVars: you did not pass in a
branch...") only runs for non-dev environments.
---
Nitpick comments:
In `@docs/config/extensions/syncEnvVars.mdx`:
- Around line 242-246: Update the Note text in the syncEnvVars extension
documentation to clarify that the extension is skipped only when the environment
name is exactly "prod" or "dev" and that it will run for any other environment
name (i.e., any environment name other than "prod" or "dev" will trigger the
sync), replacing the ambiguous phrase "preview/staging environments" in the Note
block so readers understand a literal "staging" name is not required.
In `@packages/build/src/extensions/core/syncSupabaseEnvVars.ts`:
- Around line 193-204: The code hardcodes the DB name "postgres" when calling
buildSupabaseEnvVarMappings; make the DB name configurable by adding a
databaseName option (with default "postgres") to the syncSupabaseEnvVars options
and pass that option instead of the literal string. Update the call to
buildSupabaseEnvVarMappings to use the new databaseName variable, and adjust the
function signature/usage of syncSupabaseEnvVars and any callers to
accept/forward databaseName (mirror the pattern used by syncNeonEnvVars) so
custom Supabase projects can override the default.
- Around line 187-191: The code silently ignores a failed API keys fetch
(apiKeysResponse) and may leave anonKey and serviceRoleKey unset; update the
logic in syncSupabaseEnvVars (around the apiKeysResponse handling) to detect
when apiKeysResponse.ok is false and emit a clear warning or error via the
existing logger (e.g., processLogger or logger used in this module) indicating
the API keys request failed and keys may be missing, include response.status and
response.statusText (or response.text()) in the message, and keep the current
behavior of setting anonKey/serviceRoleKey only when apiKeysResponse.ok is true.
- Around line 144-166: When no Supabase branch matches the requested branch the
code currently returns an empty array silently; add a log message right before
the early return in syncSupabaseEnvVars (the block that checks matchingBranch
after branches.find) to record the requested branch and projectId (use the
existing logger/processLogger used in this module) at warn or debug level so
users can see why env vars weren't synced; ensure the log precedes the return []
and includes identifying data (branch, projectId, and possibly the list of
available branch names) to aid debugging.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
docs/config/extensions/overview.mdxdocs/config/extensions/syncEnvVars.mdxpackages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (27)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
- GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
- GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: sdk-compat / Bun Runtime
- GitHub Check: sdk-compat / Deno Runtime
- GitHub Check: typecheck / typecheck
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
- GitHub Check: sdk-compat / Cloudflare Workers
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead
Files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use function declarations instead of default exports
Files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries
Files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
**/*.{js,ts,jsx,tsx,json,md,yaml,yml}
📄 CodeRabbit inference engine (AGENTS.md)
Format code using Prettier before committing
Files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
{packages,integrations}/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (CLAUDE.md)
When modifying public packages in
packages/*orintegrations/*, add a changeset usingpnpm run changeset:add
Files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (CLAUDE.md)
Import from
@trigger.dev/coreusing subpaths only, never the root
Files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
**/{src,app}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/{src,app}/**/*.{ts,tsx}: Always import Trigger.dev tasks from@trigger.dev/sdk. Never use@trigger.dev/sdk/v3or deprecatedclient.defineJobpattern
Every Trigger.dev task must be exported and include a uniqueidstring property
Files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Use build extensions in trigger.config.ts (additionalFiles, additionalPackages, aptGet, prismaExtension, etc.) to customize the build
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure build process in trigger.config.ts using `build` object with external packages, extensions, and JSX settings
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/app/**/*.{ts,tsx} : Access all environment variables through the `env` export of `env.server.ts` instead of directly accessing `process.env` in the Trigger.dev webapp
Learnt from: julienvanbeveren
Repo: triggerdotdev/trigger.dev PR: 2417
File: apps/webapp/app/routes/api.v1.projects.$projectRef.envvars.$slug.import.ts:56-61
Timestamp: 2025-08-19T09:49:07.011Z
Learning: In the Trigger.dev codebase, environment variables should default to `isSecret: false` when not explicitly marked as secrets in the syncEnvVars functionality. This is the intended behavior for both regular variables and parent variables.
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : When importing from `trigger.dev/core` in the webapp, use subpath exports from the package.json instead of importing from the root path
Applied to files:
packages/build/src/extensions/core.ts
📚 Learning: 2026-02-25T13:54:58.938Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-25T13:54:58.938Z
Learning: Applies to {packages,integrations}/**/*.{ts,tsx,js} : When modifying public packages in `packages/*` or `integrations/*`, add a changeset using `pnpm run changeset:add`
Applied to files:
packages/build/src/extensions/core.tspackages/build/src/extensions/core/syncSupabaseEnvVars.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Use build extensions in trigger.config.ts (additionalFiles, additionalPackages, aptGet, prismaExtension, etc.) to customize the build
Applied to files:
packages/build/src/extensions/core.tsdocs/config/extensions/overview.mdxpackages/build/src/extensions/core/syncSupabaseEnvVars.tsdocs/config/extensions/syncEnvVars.mdx
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/app/**/*.{ts,tsx} : Access all environment variables through the `env` export of `env.server.ts` instead of directly accessing `process.env` in the Trigger.dev webapp
Applied to files:
packages/build/src/extensions/core.tsdocs/config/extensions/overview.mdxpackages/build/src/extensions/core/syncSupabaseEnvVars.tsdocs/config/extensions/syncEnvVars.mdx
📚 Learning: 2026-02-25T13:54:58.938Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-25T13:54:58.938Z
Learning: Applies to **/*.{ts,tsx,js} : Import from `trigger.dev/core` using subpaths only, never the root
Applied to files:
packages/build/src/extensions/core.ts
📚 Learning: 2026-02-25T13:54:58.938Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-25T13:54:58.938Z
Learning: Applies to apps/webapp/**/*.server.{ts,tsx,js} : Access environment variables via the `env` export from `apps/webapp/app/env.server.ts`, never use `process.env` directly
Applied to files:
packages/build/src/extensions/core.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure build process in trigger.config.ts using `build` object with external packages, extensions, and JSX settings
Applied to files:
docs/config/extensions/overview.mdxpackages/build/src/extensions/core/syncSupabaseEnvVars.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `trigger.dev/sdk/v3` for all imports in Trigger.dev tasks
Applied to files:
docs/config/extensions/overview.mdx
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to packages/trigger-sdk/**/*.{ts,tsx} : In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code
Applied to files:
docs/config/extensions/overview.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use the `task()` function from `trigger.dev/sdk/v3` to define tasks with id and run properties
Applied to files:
docs/config/extensions/overview.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Attach metadata to task runs using the metadata option when triggering, and access/update it inside runs using metadata functions
Applied to files:
docs/config/extensions/overview.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use metadata methods (set, del, replace, append, remove, increment, decrement, stream, flush) to update metadata during task execution
Applied to files:
docs/config/extensions/overview.mdx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure OpenTelemetry instrumentations and exporters in trigger.config.ts for enhanced logging
Applied to files:
docs/config/extensions/overview.mdx
📚 Learning: 2025-08-19T09:49:07.011Z
Learnt from: julienvanbeveren
Repo: triggerdotdev/trigger.dev PR: 2417
File: apps/webapp/app/routes/api.v1.projects.$projectRef.envvars.$slug.import.ts:56-61
Timestamp: 2025-08-19T09:49:07.011Z
Learning: In the Trigger.dev codebase, environment variables should default to `isSecret: false` when not explicitly marked as secrets in the syncEnvVars functionality. This is the intended behavior for both regular variables and parent variables.
Applied to files:
docs/config/extensions/syncEnvVars.mdx
🔇 Additional comments (7)
docs/config/extensions/overview.mdx (1)
60-60: LGTM!The new table entry follows the established documentation pattern and correctly links to the anchor in the syncEnvVars page.
docs/config/extensions/syncEnvVars.mdx (3)
248-260: LGTM!The usage example clearly demonstrates the default configuration pattern with automatic environment variable detection.
264-282: LGTM!The advanced configuration example with explicit options is helpful and consistent with the other sync extension documentation.
284-291: LGTM!The environment variables list is comprehensive and matches the implementation in
SUPABASE_ENV_VARS.packages/build/src/extensions/core/syncSupabaseEnvVars.ts (3)
1-2: LGTM!Imports correctly use the subpath for
@trigger.dev/core/v3/buildas per coding guidelines.
4-29: LGTM!Type definitions use
typekeyword as required by the coding guidelines.
226-231: LGTM!The extension correctly wraps the
syncEnvVarshelper and delegates toonBuildComplete.
| export * from "./core/ffmpeg.js"; | ||
| export * from "./core/neonSyncEnvVars.js"; | ||
| export * from "./core/vercelSyncEnvVars.js"; | ||
| export * from "./core/syncSupabaseEnvVars.js"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# List changeset files to see if one was added for this PR
ls -la .changeset/ 2>/dev/null | grep -v "^\." | head -20Repository: triggerdotdev/trigger.dev
Length of output: 526
🏁 Script executed:
# Check the content of any changeset files that might be new (excluding config)
find .changeset -type f -name "*.md" | head -20 | xargs -I {} sh -c 'echo "=== {} ===" && head -10 {}'Repository: triggerdotdev/trigger.dev
Length of output: 1276
🏁 Script executed:
# Verify the file in question exists and shows the correct line
cat -n packages/build/src/extensions/core.ts | head -15Repository: triggerdotdev/trigger.dev
Length of output: 455
LGTM on the re-export pattern. A changeset for @trigger.dev/build is required for this public package modification—add one using pnpm run changeset:add.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/build/src/extensions/core.ts` at line 8, Add a changeset for the
public package `@trigger.dev/build` to record the re-export change; run the
command `pnpm run changeset:add` and create a changeset entry describing the
export of "./core/syncSupabaseEnvVars.js" from
packages/build/src/extensions/core.ts so the package version and changelog are
updated accordingly.
| // Skip branch-specific logic for production environment | ||
| if (ctx.environment === "prod") { | ||
| return []; | ||
| } | ||
|
|
||
| if (!branch) { | ||
| throw new Error( | ||
| "syncSupabaseEnvVars: you did not pass in a branch and no branch was detected from context." | ||
| ); | ||
| } | ||
|
|
||
| if (ctx.environment === "dev") { | ||
| // Skip syncing for development environment | ||
| return []; | ||
| } |
There was a problem hiding this comment.
Reorder environment checks to avoid unexpected errors in dev environment.
The dev environment skip (line 135) is checked after the branch validation (line 129). If a user deploys to dev without a branch, they'll get a confusing error about missing branch instead of the expected silent skip.
Move the dev check before the branch validation to match the documented behavior.
Proposed fix
// Skip branch-specific logic for production environment
if (ctx.environment === "prod") {
return [];
}
+ if (ctx.environment === "dev") {
+ // Skip syncing for development environment
+ return [];
+ }
+
if (!branch) {
throw new Error(
"syncSupabaseEnvVars: you did not pass in a branch and no branch was detected from context."
);
}
-
- if (ctx.environment === "dev") {
- // Skip syncing for development environment
- return [];
- }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Skip branch-specific logic for production environment | |
| if (ctx.environment === "prod") { | |
| return []; | |
| } | |
| if (!branch) { | |
| throw new Error( | |
| "syncSupabaseEnvVars: you did not pass in a branch and no branch was detected from context." | |
| ); | |
| } | |
| if (ctx.environment === "dev") { | |
| // Skip syncing for development environment | |
| return []; | |
| } | |
| // Skip branch-specific logic for production environment | |
| if (ctx.environment === "prod") { | |
| return []; | |
| } | |
| if (ctx.environment === "dev") { | |
| // Skip syncing for development environment | |
| return []; | |
| } | |
| if (!branch) { | |
| throw new Error( | |
| "syncSupabaseEnvVars: you did not pass in a branch and no branch was detected from context." | |
| ); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/build/src/extensions/core/syncSupabaseEnvVars.ts` around lines 124 -
138, The branch-missing error is raised before we skip for dev, causing false
errors when ctx.environment === "dev"; update the logic in syncSupabaseEnvVars
(the function using ctx.environment and branch) to check if ctx.environment ===
"dev" and return [] before performing the branch validation, so the branch-null
throw ("syncSupabaseEnvVars: you did not pass in a branch...") only runs for
non-dev environments.