Skip to content

v7.9.2 seems to introduce CORS issue with Firebase Storage #2695

@lupas

Description

@lupas

Describe your environment

  • Operating System version: Mac OS Catalina 10.15.3 (19D76)
  • Browser version: 80.0.3987.122 (Official Build) (64-bit)
  • Firebase SDK version: 7.9.2
  • Firebase Product: Storage

Describe the problem

With 7.9.2, Firebase Storage .put() throws the following CORS error on localhost:

Access to fetch at 'https://firebasestorage.googleapis.com/v0/b/appId.appspot.com/o?name=_userdata%2FYixPa2SRSiRZ6OaYrDJN9cFLL6t1%2FuserPic.jpg'
from origin 'http://localhost:3000' has been blocked by CORS policy:
Request header field x-firebase-gmpid is not allowed by Access-Control-Allow-Headers
in preflight response.

Also see StackOverflow issue here.

Same code works with 7.9.1.

Steps to reproduce:

Seems to appear anytime put(), putString() and so on is called to upload a file to Firebase Storage.

Relevant Code:

Example:

async upload(base64Img, metadata, path) {
  const storageRef = storage.
    .ref()
    .child(`${path}/photo.jpg`)

  try {
    await storageRef.putString(base64Img, 'base64', metadata)
  } catch (e) {
    // handle error
  }
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions