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 f859b0c

Browse filesBrowse files
committed
fix: handle case of env not being defined for edge functions
1 parent 91d4b81 commit f859b0c
Copy full SHA for f859b0c

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+5
-3
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) {

0 commit comments

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