Skip to content
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

Not Using Latest Version of @google-cloud/storage - Mismatch Bucket Typing #2149

Closed
babbott-coalesce opened this issue Apr 12, 2023 · 3 comments

Comments

@babbott-coalesce
Copy link

[READ] Step 1: Are you in the right place?

  • For issues related to the code in this repository file a Github issue.
  • If the issue pertains to Cloud Firestore, read the instructions in the "Firestore issue"
    template.
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Operating System version: MacOS 13.2 (22D49)
  • Firebase SDK version: firebase: 9.19.1, firebase-admin: 11.6.0
  • Firebase Product: storage (auth, database, storage, etc)
  • Node.js version: 18.14.1
  • NPM version: 9.3.1

[REQUIRED] Step 3: Describe the problem

Updated to latest versions of @google-cloud/storage (6.9.5) and firebase-admin (11.6.0). firebase-admin seems to want to use version 6.5.2 of @google-cloud/storage, which uses an incompatible version of Bucket.

I was able to fix the issue by manually changing yarn.lock to only have version 6.9.5 of @google-cloud/storage.

Steps to reproduce:

Install the latest versions of @google-cloud/storage and firebase-admin and try to set a variable typed as Bucket with a storage that could be of type admin.storage.Storage from firebase-admin.

Relevant Code:

(Simplified) Code Snippet

import { Storage, Bucket } from "@google-cloud/storage";
import * as admin from "firebase-admin";

export class GoogleCloudStorage {
  constructor(storage: Storage | admin.storage.Storage, storageBucket: string) {
    super();
    this.bucket = storage.bucket(storageBucket);
  }
}

error in vscode:

Type 'Bucket | Bucket' is not assignable to type 'Bucket'.

yarn.lock

firebase-admin@^11.6.0:
  version "11.6.0"
  resolved ***
  integrity ***
  dependencies:
    "@fastify/busboy" "^1.1.0"
    "@firebase/database-compat" "^0.3.0"
    "@firebase/database-types" "^0.10.0"
    "@types/node" ">=12.12.47"
    jsonwebtoken "^9.0.0"
    jwks-rsa "^3.0.1"
    node-forge "^1.3.1"
    uuid "^9.0.0"
  optionalDependencies:
    "@google-cloud/firestore" "^6.4.0"
    "@google-cloud/storage" "^6.5.2"
@lahirumaramba
Copy link
Member

Hi @babbott-coalesce , since @google-cloud/storage is listed as an optional dependency and since we do not pin to a specific version of the library, you should be able to manually upgrade to the latest version. This should also addressed in #2147, which we will include in this week's release. Thanks!

@babbott-coalesce
Copy link
Author

Fixed with

"firebase": "^9.20.0",
"firebase-admin": "^11.7.0",

Thanks!

@sebastianrueckerai
Copy link

Still happening with

    "@google-cloud/storage": "^7.7.0",
    "firebase": "^10.7.2",
    "firebase-admin": "^12.0.0",

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

No branches or pull requests

4 participants