-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: skip extensions API check when no extensions are defined #9989
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -171,6 +171,14 @@ export async function prepareDynamicExtensions( | |
| const filters = getEndpointFilters(options, functionsConfig); | ||
| const extensions = extractExtensionsFromBuilds(builds, filters); | ||
| const projectId = needProjectId(options); | ||
|
|
||
| // Skip extensions API checks if no extensions are defined in the builds. | ||
| // This avoids unnecessary API calls and permission errors for projects | ||
| // that don't use Firebase Extensions but still deploy functions. | ||
| if (Object.keys(extensions).length === 0) { | ||
| return; | ||
| } | ||
|
|
||
| const projectNumber = await needProjectNumber(options); | ||
|
|
||
| await ensureExtensionsApiEnabled(options); | ||
|
|
@@ -181,8 +189,8 @@ export async function prepareDynamicExtensions( | |
| extensionMatchesAnyFilter(e.labels?.codebase, e.instanceId, filters), | ||
| ); | ||
|
|
||
| if (Object.keys(extensions).length === 0 && haveExtensions.length === 0) { | ||
| // Nothing defined, and nothing to delete | ||
| if (haveExtensions.length === 0) { | ||
| // Nothing to delete | ||
| return; | ||
| } | ||
|
Comment on lines
+192
to
195
Contributor
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 new condition appears to introduce a bug. If a user is adding dynamic extensions to a project for the first time, Given the check for |
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change correctly avoids API calls when no extensions are defined in code, which fixes the issue for users not using extensions. However, this introduces a change in behavior. Previously, removing a dynamic extension from functions code and re-deploying would trigger its deletion. With this early return, deletion of dynamic extensions during a function deploy will no longer occur. Users will have to use
firebase ext:uninstallinstead. Is this change in workflow intended?