Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca1b7e8

Browse filesBrowse files
authored
fix: handle case of env not being defined for edge functions (#2936)
* chore: adjust pattern for sites->projects rename * fix: handle case of env not being defined for edge functions
1 parent 8b0cf3d commit ca1b7e8
Copy full SHA for ca1b7e8

File tree

Expand file treeCollapse file tree

3 files changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-5
lines changed

‎src/build/functions/edge.ts

Copy file name to clipboardExpand all lines: src/build/functions/edge.ts
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,11 @@ const copyHandlerDependencies = async (
132132

133133
const outputFile = join(destDir, `server/${name}.js`)
134134

135-
// Prepare environment variables for draft-mode (i.e. __NEXT_PREVIEW_MODE_ID, __NEXT_PREVIEW_MODE_SIGNING_KEY, __NEXT_PREVIEW_MODE_ENCRYPTION_KEY)
136-
for (const [key, value] of Object.entries(env)) {
137-
parts.push(`process.env.${key} = '${value}';`)
135+
if (env) {
136+
// Prepare environment variables for draft-mode (i.e. __NEXT_PREVIEW_MODE_ID, __NEXT_PREVIEW_MODE_SIGNING_KEY, __NEXT_PREVIEW_MODE_ENCRYPTION_KEY)
137+
for (const [key, value] of Object.entries(env)) {
138+
parts.push(`process.env.${key} = '${value}';`)
139+
}
138140
}
139141

140142
if (wasm?.length) {

‎tests/netlify-deploy.ts

Copy file name to clipboardExpand all lines: tests/netlify-deploy.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class NextDeployInstance extends NextInstance {
148148

149149
try {
150150
const deployUrlRegex = new RegExp(
151-
/https:\/\/app\.netlify\.com\/sites\/(?<siteName>[^\/]+)\/deploys\/(?<deployID>[0-9a-f]+)/gm,
151+
/https:\/\/app\.netlify\.com\/(sites|projects)\/(?<siteName>[^\/]+)\/deploys\/(?<deployID>[0-9a-f]+)/gm,
152152
).exec(deployRes.stdout)
153153
const [buildLogsUrl] = deployUrlRegex || []
154154
const { deployID, siteName } = deployUrlRegex?.groups || {}

‎tests/utils/create-e2e-fixture.ts

Copy file name to clipboardExpand all lines: tests/utils/create-e2e-fixture.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ async function deploySite(
281281

282282
const { siteName, deployID } =
283283
new RegExp(
284-
/app\.netlify\.com\/sites\/(?<siteName>[^\/]+)\/deploys\/(?<deployID>[0-9a-f]+)/gm,
284+
/app\.netlify\.com\/(sites|projects)\/(?<siteName>[^\/]+)\/deploys\/(?<deployID>[0-9a-f]+)/gm,
285285
).exec(output)?.groups || {}
286286

287287
if (!deployID) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.