Skip to content

Commit 5114193

Browse files
authored
fix: handle missing manifest functions field (#1416)
1 parent ed26815 commit 5114193

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

plugin/src/helpers/edge.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,17 @@ export const writeEdgeFunctions = async (netlifyConfig: NetlifyConfig) => {
155155
})
156156
manifest.functions.push(functionDefinition)
157157
}
158-
159-
for (const edgeFunctionDefinition of Object.values(middlewareManifest.functions)) {
160-
const functionDefinition = await writeEdgeFunction({
161-
edgeFunctionDefinition,
162-
edgeFunctionRoot,
163-
netlifyConfig,
164-
})
165-
manifest.functions.push(functionDefinition)
158+
// Older versions of the manifest format don't have the functions field
159+
// No, the version field was not incremented
160+
if (typeof middlewareManifest.functions === 'object') {
161+
for (const edgeFunctionDefinition of Object.values(middlewareManifest.functions)) {
162+
const functionDefinition = await writeEdgeFunction({
163+
edgeFunctionDefinition,
164+
edgeFunctionRoot,
165+
netlifyConfig,
166+
})
167+
manifest.functions.push(functionDefinition)
168+
}
166169
}
167170

168171
await writeJson(join(edgeFunctionRoot, 'manifest.json'), manifest)

0 commit comments

Comments
 (0)