Skip to content

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

Description

@babbott-coalesce

[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"

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions