storage.upload does not catch error as expected
See original GitHub issueVersion 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 **
Expected behavior
Error to be caught
Actual behavior
Error is not caught
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.)
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