Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Reduce the number of transitive dependencies #1711

Closed

Description

@IchordeDionysos

The package contains 79 direct/transitive dependencies, it would be nice if this number could be reduced!

While Firestore itself does not contain lots of dependencies GRPC/Protobuf and google-gax do pull in a few of those, which in itself contributes lots of transitive dependencies to this package and the firebase-admin package.

google-gax alone has 76 dependencies: http://npm.anvaka.com/#/view/2d/google-gax

And especially when integrated into bigger projects this adds quite a bit of baggage to the project and more risk for security vulnerabilities (like longer chains to update vulnerable dependency versions).

http://npm.anvaka.com/#/view/2d/%2540google-cloud%252Ffirestore
https://bundlephobia.com/package/@google-cloud/[email protected]

Activity

  1. added
    priority: p3
    type: feature request
    on Apr 21, 2022
  2. added
    api: firestore
    on Apr 21, 2022
  3. dconeybe commented on Apr 26, 2022

    @dconeybe
    Contributor

    Hi @IchordeDionysos. Thanks for pointing out this issue. Those dependencies you mention are hard dependencies and the Firestore SDK cannot function without them. If you have any suggestions then maybe we could discuss. But dropping those dependencies is not feasible.

  4. self-assigned this
    on Apr 26, 2022
  5. added
    needs more info
    on Apr 26, 2022
  6. IchordeDionysos commented on Apr 28, 2022

    @IchordeDionysos
    ContributorAuthor

    Hey @dconeybe,
    I understand the hard dependency on the libraries :) I'm a bit also trying to challenge the additional transitive libraries that are included in them!

    For e.g. why use a package like arrify for such a simple task, when upstream it leads to yet another dependency to manage/install and potentially with security issues or a longer time until a critical security flaw is fixed in all downstream dependencies.

    But one of the bigger questions I have is regarding transitive dependencies, why do I have to install yargs which is a tool that parses command-line arguments, when in reality this feature is NEVER used.

    yargs is used by @grpc/proto-loader which is used by google-gax.

    And looking at the usage of yargs in the proto-loader you can see that it's only used in one spot in the runScript function:
    https://github.com/grpc/grpc-node/blob/6847664da22dcaefb4cd0b93674c43e904d6b639/packages/proto-loader/bin/proto-loader-gen-types.ts
    https://github.com/grpc/grpc-node/blob/6847664da22dcaefb4cd0b93674c43e904d6b639/packages/proto-loader/bin/proto-loader-gen-types.ts#L771

    And the runScript function is only run when executed directly, so there is no reason to be pulled in when used with Firestore.


    So I want to bring up this bigger question when a library is such a low-level Google library, all dependencies should be really carefully chosen as they lead up to a lot bigger dependency tree when composed into bigger end-user dependencies!

    There are a ton of libraries there all owned and maintained by Google that I did not know where to start and file the issue, so I started here in the user-facing library, I would be happy if you could elevate and escalate the issue to other teams responsible for those packages.

    And @google-cloud/storage has again super different dependencies than Firestore it uses gaxios vs. google-gax.
    http://npm.anvaka.com/#/view/2d/%2540google-cloud%252Fstorage

  7. dconeybe commented on May 17, 2022

    @dconeybe
    Contributor

    You are right that the dependency on yargs looks to be unnecessary; however, that is a transitive dependency over which we, the maintainers of this repository, do not have control. Unfortunately, we cannot prioritize pruning transitive dependencies against our current priorities. If there is a direct dependency of this repository that you believe could be pruned or replaced with a lighter alternative then we can consider that; however, performing this optimization on our transitive dependencies is something we don't have bandwidth or sufficient demand to prioritize. Your motivation to undergo this exercise definitely makes sense and I apologize that we cannot help you. The specific example of yargs is something that you could bring up with the maintainers of @grpc/proto-loader directly and that improvement would be picked up when this repository upgrades its dependencies. I'm going to close this issue for now; however, if you have suggested/requested direct dependency changes of this repository then please open a new issue and, optionally, mention this issue in the new issue's description. Thank you for your time and feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: firestoreneeds more infopriority: p3type: feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions