Skip to content

Conversation

@pieh
Copy link
Contributor

@pieh pieh commented Oct 24, 2025

🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes https://linear.app/netlify/issue/FRB-2024/ensure-edge-functions-are-bundled-with-no-build-option


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@github-actions
Copy link

github-actions bot commented Oct 24, 2025

📊 Benchmark results

Comparing with 31b1e09

  • Dependency count: 1,064 (no change)
  • Package size: 321 MB (no change)
  • Number of ts-expect-error directives: 380 ⬆️ 0.26% increase vs. 31b1e09

@pieh pieh force-pushed the fix/bundle-edge-functions-on-no-build-deploy branch from 236579a to 1690d6d Compare October 24, 2025 11:39
…nd use inline config, also add cases for internal and framework functions
@pieh pieh force-pushed the fix/bundle-edge-functions-on-no-build-deploy branch from 1690d6d to dabc560 Compare October 24, 2025 12:49
@pieh pieh force-pushed the fix/bundle-edge-functions-on-no-build-deploy branch from 5602c96 to 4fe4444 Compare October 24, 2025 14:13
Comment on lines +731 to +735
// (cachedConfig type error hides this one, but it still is valid) @ts-expect-error FIXME(serhalp): This is missing from the `runCoreSteps` type in @netlify/build
edgeFunctionsBootstrapURL: await getBootstrapURL(),
// @ts-expect-error 'CachedConfig' is not assignable to type 'Record<string, unknown>'.
// Index signature for type 'string' is missing in type 'CachedConfig'.
cachedConfig: command.netlify.cachedConfig,
Copy link
Contributor Author

@pieh pieh Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit frustrating, once I do add cachedConfig here, it no longer complain about edgeFunctionsBootstrapURL and now it actually complain about @ts-expect-error for it ... but this is still valid, just somehow hidden because of cachedConfig type error ...

Passing cachedConfig seems needed to properly support --cwd other/dir case, as otherwise bundling was trying to look in current directory and there doesn't seem to be other arguments we can pass to tell it to look elsewhere (despite passing cwd explitly above).

@pieh pieh marked this pull request as ready for review October 24, 2025 14:24
@pieh pieh requested a review from a team as a code owner October 24, 2025 14:24
Comment on lines +874 to 880
// build flag wasn't used and edge functions directories exist
if (!options.build && (await anyEdgeFunctionsDirectoryExists(command))) {
// for the case of directories existing but not containing any edge functions,
// there is early bail in edge functions bundling after scanning for edge functions
// for this case and to avoid replicating scanning logic here, we defer to the bundling step
await bundleEdgeFunctions(options, command)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous condition doesn't seem to be met unless you specify some edge functions configuration in toml (?) so instead we check if there are edge functions dir present and trigger on-demand edge bundling if they are

if directories exist but contain on edge functions - there will be early bail - that's just edge bundling function step in @netlify/build works, so I opted not trying to repeat same logic here

@pieh pieh merged commit 132cf76 into main Oct 29, 2025
72 of 74 checks passed
@pieh pieh deleted the fix/bundle-edge-functions-on-no-build-deploy branch October 29, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants