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

FirebaseError: Firebase Storage: An unknown error occurred #8611

Open
CodingWithTashi opened this issue Oct 28, 2024 · 1 comment
Open

FirebaseError: Firebase Storage: An unknown error occurred #8611

CodingWithTashi opened this issue Oct 28, 2024 · 1 comment

Comments

@CodingWithTashi
Copy link

Operating System

macOS Sonama 14.6.1 (23G93)

Environment (if applicable)

Chrome Version 130.0.6723.70 (Official Build) (arm64)

Firebase SDK Version

11.0.1

Firebase SDK Product(s)

Storage

Project Tooling

Chrome extension with webpack and tailwind css

Detailed Problem Description

I am trying to upload media file(eg 4mb audio file) to firebase storage with uploadBytesResumable. But I am getting Firebase Storage: An unknown error occurred. When I use uploadBytes it worked fine. Since I need progress to track the upload. This is a showstopper for me.

Error uploading file: FirebaseError: Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown)

Steps and code to reproduce issue

This code works

function uploadData(
  uint8Array: Uint8Array,
) {
  let app = initializeApp(firebaseConfig)
  const storageRef = ref(getStorage(app), `${"path"}/${"test.mp3"}`)
  let task = uploadBytes(storageRef, uint8Array, {
    contentType: "audio/mpeg",
  })

}

But the below code always fails


function uploadData(
  uint8Array: Uint8Array,
) {
  let app = initializeApp(firebaseConfig)
  const storageRef = ref(getStorage(app), `${"path"}/${"test.mp3"}`)

  const metadata = {
    contentType: "audio/mpeg",
  }
  let uploadTask = uploadBytesResumable(storageRef, uint8Array, metadata)
  uploadTask.on(
    "state_changed",
    (snapshot) => {
      const currentProgress = Math.round(
        (snapshot.bytesTransferred / snapshot.totalBytes) * 100,
      )
      console.log(`Progress: ${currentProgress}%`)
    },
    (error) => {
      console.error("Error uploading file:", error)
    },
    () => {
      console.log("File uploaded successfully")
      getDownloadURL(uploadTask.snapshot.ref)
        .then((url) => console.log("Download URL:", url))
        .catch((err) => console.error(err))
        .finally(() => {
          console.log("File upload completed  ")
        })
    },
  )
}
image

Note: It does work with small mp3(72.24 KB)

@CodingWithTashi CodingWithTashi added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Oct 28, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: storage needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Oct 28, 2024
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

3 participants