Skip to content

fix: await zipFunctions() in functions build #7180

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

Merged
merged 6 commits into from
Apr 14, 2025
Merged

Conversation

serhalp
Copy link
Collaborator

@serhalp serhalp commented Apr 9, 2025

Summary

The types fixes in #7130 identified a number of bugs. This fixes one of those.

Copy link

github-actions bot commented Apr 9, 2025

📊 Benchmark results

Comparing with e7cd9e5

  • Dependency count: 1,237 (no change)
  • Package size: 311 MB (no change)
  • Number of ts-expect-error directives: 421 (no change)

@serhalp serhalp marked this pull request as ready for review April 9, 2025 16:15
@serhalp serhalp requested a review from a team as a code owner April 9, 2025 16:15
): string | undefined =>
('functions' in options && typeof options.functions === 'string' ? options.functions : null) ??
config.dev?.functions ??
config.functionsDirectory ??
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this a behavioral change? Won't this now allow config.dev.functions and config.functionsDirectory to be an empty string? Or do we sanitize empty strings out somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how you could even end up with an empty string, other than explicitly using "" in your netlify.toml or something... 🤔

I feel like it isn't worth the added complexity to this line to support ignoring hypothetical empty strings here, but in the interest of limiting behavioural changes I'll go ahead and add the conditions 🙈.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's worth the added complexity here or the change risk, however low that risk is (you're still adding in new behavior by checking for strings with only whitespace in them). I don't think that bundling it in with a clear and totally unrelated bug is really the way to go about this change, either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought that trim() wouldn't be controversial, but alright, I've reverted that too.

@@ -10,7 +10,7 @@ import type BaseCommand from '../base-command.js'
export const functionsBuild = async (options: OptionValues, command: BaseCommand) => {
const { config } = command.netlify

const src = options.src || config.build.functionsSource
const src = ('src' in options && typeof options.src === 'string' ? options.src : null) ?? config.build.functionsSource
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here--this will now allow an empty string, won't it?

@serhalp serhalp requested a review from ndhoule April 14, 2025 20:10
@serhalp serhalp enabled auto-merge (squash) April 14, 2025 21:37
@serhalp serhalp merged commit e3b04e5 into main Apr 14, 2025
52 checks passed
@serhalp serhalp deleted the fix/wait-for-function-build branch April 14, 2025 21:56
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.

2 participants