Skip to content

Fix bug where CLI was unable to deploy Firebase Functions in some monorepo setups - #5391

Merged
taeold merged 11 commits into
masterfrom
dl-cf3-npm-workspaces
Jan 6, 2023
Merged

taeold merged 11 commits into
masterfrom
dl-cf3-npm-workspaces

Conversation

@taeold

@taeold taeold commented Jan 4, 2023

Copy link
Copy Markdown
Contributor

Partially fixes #4952.

#5215 made changes to the CLI to detect Functions SDK even in monorepo setups where Functions SDK is hoisted (i.e. Functions SDK dependency is declared in the parent directory but not in the sub-package directory).

We should've made corresponding change in how the Functions SDK binary is executed - instead of always looking up the sub-package's node_modules, we should be looking at the node_modules closest to where the Functions SDK dependency is declared.

This setup seems common in scenarios where the developer bundles the functions source using bundlers like vite/webpack/etc. This kind of technique has shown to help AWS lambda's cold start time, and I think it's something we'd want to explore in Google Cloud Functions too.

@taeold
taeold marked this pull request as ready for review January 4, 2023 17:29
@codecov-commenter

codecov-commenter commented Jan 4, 2023 •

Copy link
Copy Markdown

Codecov Report

Base: 56.32% // Head: 56.32% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (a86956f) compared to base (68bdfa7).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5391      +/-   ##
==========================================
- Coverage   56.32%   56.32%   -0.01%     
==========================================
  Files         315      315              
  Lines       21296    21298       +2     
  Branches     4342     4342              
==========================================
  Hits        11996    11996              
- Misses       8261     8263       +2     
  Partials     1039     1039              
Impacted Files Coverage Δ
src/deploy/functions/runtimes/node/index.ts 24.65% <0.00%> (-0.70%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@blidd-google blidd-google left a comment

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.

lgtm

@taeold
taeold enabled auto-merge (squash) January 5, 2023 22:07
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.

Function deployment fails with npm workspaces/nx - Error: spawn ./node_modules/.bin/firebase-functions ENOENT

3 participants