Skip to content

[@firebase/rules-unit-testing] InitializeTestApp fails - storage is not a function #4944

@dennemark

Description

@dennemark

Describe your environment

  • Operating System version: Windows 10
  • Browser version: Chrome 90
  • Firebase SDK version: @firebase/rules-unit-testing v. 1.3.2 + newest emulators
  • Firebase Product: storage

Describe the problem

When trying to test storage rules, I cannot initialize the test app, supplying the storageBucket parameter. I get the following error: TypeError: app.storage is not a function

This should be the minimal code example:

import * as fbTesting from "@firebase/rules-unit-testing"; const app = fbTesting.initializeTestApp({ projectId: MY_PROJECT_ID, storageBucket: MY_STORAGE_BUCKET, auth: MY_AUTH}) 

If I use the admin app instead fbTesting.initializeAdminApp(...), I can use the storageBucket parameter and write to the emulator.

I read in a few posts, that it is necessary to import firebase/storage, but this happens here:

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