Skip to content

Commit 7cbf82a

Browse files
committed
fix: PR feedback, doc improvements for neon/vercel syncEnvVars
1 parent 53f21e1 commit 7cbf82a

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

docs/config/extensions/syncEnvVars.mdx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,18 @@ The `syncVercelEnvVars` build extension syncs environment variables from your Ve
8585
environment variable values will be read from `process.env` instead of fetching them from the
8686
Vercel API. This is determined by checking if the `VERCEL` environment variable is present. The
8787
API is still used to determine which environment variables are configured for your project, but
88-
the actual values come from the local environment.
88+
the actual values come from the local environment. Reading values from `process.env` allows the
89+
extension to use values that Vercel integrations (such as the Neon integration) set per preview
90+
deployment in the "Provisioning Integrations" phase that happens just before the Vercel build
91+
starts.
92+
</Note>
93+
94+
<Note>
95+
If you have the Neon database Vercel integration installed and are running builds outside of the
96+
Vercel environment, we recommend using `syncNeonEnvVars` in addition to `syncVercelEnvVars` for your
97+
database environment variables. This ensures that the correct database connection strings are used for your
98+
selected environment and current branch, as `syncVercelEnvVars` may not accurately reflect
99+
branch-specific database credentials when run locally.
89100
</Note>
90101

91102
```ts
@@ -139,9 +150,17 @@ The `syncNeonEnvVars` build extension syncs environment variables from your Neon
139150
Vercel integration already handles environment variable synchronization in Vercel environments.
140151
</Note>
141152

153+
<Note>
154+
If you have the Neon database Vercel integration installed and are running builds outside of the
155+
Vercel environment, we recommend using `syncNeonEnvVars` in addition to `syncVercelEnvVars` for your
156+
database environment variables. This ensures that the correct database connection strings are used for your
157+
selected environment and current branch, as `syncVercelEnvVars` may not accurately reflect
158+
branch-specific database credentials when run locally.
159+
</Note>
160+
142161
<Note>
143162
This extension is skipped for `prod` environments. It is designed to sync branch-specific
144-
database connections for preview/staging/dev environments.
163+
database connections for preview/staging environments.
145164
</Note>
146165

147166
```ts

packages/build/src/extensions/core/neonSyncEnvVars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ export function syncNeonEnvVars(options?: {
132132
);
133133
}
134134

135+
if (environment === "development") {
136+
// Skip syncing for development environment
137+
return [];
138+
}
139+
135140
try {
136141
// Step 1: Search for the branch in Neon
137142
const branchSearchParams = new URLSearchParams({ search: branch });

0 commit comments

Comments
 (0)