Skip to content

Need to use connectStorageEmulator() for each bucket you use #7868

Open
@russellwheatley

Description

@russellwheatley

Operating System

macOS 14.0

Browser Version

Chrome 120.0.6099.71 (Official Build) (arm64)

Firebase SDK Version

10.6.0

Firebase SDK Product:

Storage

Describe your project's tooling

rollup. Essentially bundles into HTML JS script.

Describe the problem

Every additional storage bucket used requires using connectStorageEmulator() for each one. Otherwise, it will hit the live Storage bucket. Previously, this wasn't the case but I'm not sure when this behaviour changed.

I've observed this behaviour across web, ios and android Firebase SDKs. I can't see this documented anywhere. Was this intentional? Happy to close out if it was, but perhaps it should be documented.

Steps and code to reproduce issue

// Initialize Firebase
const app = initializeApp(config);

const storage = getStorage(app);
// connects to local emulator
connectStorageEmulator(storage, 'localhost', 9199);

// connects to live storage bucket unless you use connectStorageEmulator() again
const secondBucket = getStorage(app, 'gs://another-bucket.appspot.com');

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