Skip to content

fix: await zipFunctions() in functions build - #7180

Merged
serhalp merged 6 commits into
mainfrom
fix/wait-for-function-build
Apr 14, 2025
Merged

serhalp merged 6 commits into
mainfrom
fix/wait-for-function-build

Conversation

@serhalp

@serhalp serhalp commented Apr 9, 2025

Copy link
Copy Markdown
Member

Summary

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

@github-actions

github-actions Bot commented Apr 9, 2025 •

Copy link
Copy Markdown

📊 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
Comment thread src/utils/functions/functions.ts Outdated
): string | undefined =>
('functions' in options && typeof options.functions === 'string' ? options.functions : null) ??
config.dev?.functions ??
config.functionsDirectory ??

Copy link
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
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
Copy Markdown
Member 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.

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
Copy Markdown
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
@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