question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

storage.upload does not catch error as expected

See original GitHub issue

Version info

Angular: 5.2.8

Firebase: 4.12

AngularFire: 5.0.0-rc.6

How to reproduce these conditions

https://stackblitz.com/edit/angular-storage-experiment?file=app%2Fapp.component.ts

Steps to set up and reproduce Just try to use the web app and upload a pdf file, the firebase instance have rules that reject such upload, the problem is that in app.component.ts file the try and catch does not work and thrown error is not caught

Sample data and security rules

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if false;
    }
  }
}

Debug output

** Errors in the JavaScript console **

 ERROR Error: Uncaught (in promise): FirebaseStorageError: {"code_":"storage/unauthorized","message_":"Firebase Storage: User does not have permission to access 'java.pdf'.","serverResponse_":"{\n  \"error\": {\n    \"code\": 403,\n    \"message\": \"Permission denied. Could not perform this operation\"\n  }\n}","name_":"FirebaseError"}

** Output from firebase.database().enableLogging(true); **

** Screenshots ** screen_two

Expected behavior

Error to be caught

Actual behavior

Error is not caught

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
NELBNLcommented, Mar 30, 2018

try it like this: https://stackblitz.com/edit/angular-storage-experiment-rmcqn4

edit: I just took a closer look at this with my IDE. It seems to make things worse (‘then’ shouldn’t be used that way, and it defeats the purpose of the Percentage observable.)

0reactions
jamesdanielscommented, Apr 1, 2018

I’ve noticed catch is not working as expected in the JS SDK in several spots, can you open an issue on their repo since you’re using their API in this case? https://github.com/firebase/firebase-js-sdk/issues/new

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle errors for Cloud Storage on Web - Firebase
Handle Error Messages ; storage/cannot-slice-blob, Commonly occurs when the local file has changed (deleted, saved again, etc.). Try uploading again after ...
Read more >
NodeJs AWS-SDK s3.upload upload function not throwing ...
It works when credentials are correctly set. But if they are missing, error CredentialsError: Missing credentials in config, if using ...
Read more >
CompleteMultipartUpload - Amazon Simple Storage Service
Completes a multipart upload by assembling previously uploaded parts. You first initiate the multipart upload and then upload all parts using the UploadPart ......
Read more >
Data Import error message reference - Analytics Help
Message Meaning So... Empty column header at column number X. The upload file is missing a column header. Ed... Multiple errors occurred: List of multiple...
Read more >
Resolve errors | Google Drive
Resolve a 403 error: Daily limit exceeded ... This error appears when the application's owner has set a quota limit to cap usage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found