-
Notifications
You must be signed in to change notification settings - Fork 78
fix: handling for empty cases in edge bundling #6657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -116,6 +116,10 @@ const coreStep = async function ({ | |||||||||||||||||||||||||||||||||||||||||||||||||||
bootstrapURL: edgeFunctionsBootstrapURL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
vendorDirectory, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
// There were no functions to bundle, can exit this step early | ||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!manifest) return {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
const metrics = getMetrics(manifest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. by returning early, we're no longer recording these metrics (on line 152–153) with zeros. this might trigger some alerts or require some adjustments / context sharing. maybe we could avoid this change to keep things simple? and to allow tracking number of builds with no EFs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also completely skip the entire step already of This is overall similar scenario. We pondered about expanding current condition: build/packages/build/src/plugins_core/edge_functions/index.ts Lines 156 to 180 in 7782f6d
and try to find functions there already and skip entire step then, but it did feel a bit wasteful to repeat steps of trying to find edge functions multiple times and opted to do "early bail" inside step itself using edge functions search that we already do |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
systemLog('Edge Functions manifest:', manifest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"functions": [], | ||
"version": 1 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,10 @@ export const bundle = async ( | |
const userFunctions = userSourceDirectories.length === 0 ? [] : await findFunctions(userSourceDirectories) | ||
const internalFunctions = internalSrcFolder ? await findFunctions(internalSrcFolders) : [] | ||
const functions = [...internalFunctions, ...userFunctions] | ||
|
||
// Early exit when there are no functions to bundle | ||
if (functions.length === 0) return {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this results in a breaking change to the signature of the (btw personal opinion but this is why I like https://typescript-eslint.io/rules/explicit-function-return-type/. it forces changes to return types to be explicit and visible.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you thinking this shouldn't be touched and we should only make the change on the adapter side of things? Just trying my best to understand what the way forward is that is being suggested. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think it make sense try not to touch edge-bundler and in particular change signature if possible here. I did take a look at how we handle this for serverless and we have similar early bail there, but it is in step itself instead of bundler/zisi and applied similar change in #6659 which is alternative to this PR - no breaking changes there and no additional file lookups |
||
|
||
const vendor = await safelyVendorNPMSpecifiers({ | ||
basePath, | ||
featureFlags, | ||
|
Uh oh!
There was an error while loading. Please reload this page.