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.

ERROR Error: [object Object] while uploading images in storage

See original GitHub issue

Hi Team,

I am developing one application and I have used ionic 3.9.2 and I am trying to upload an image in firebase storage and the angularfire 2 version is 5.0.0-rc.4 and firebase 4.8.0.

I tried to get the image from Camera

 const cameraOptions: CameraOptions = {
      quality: 50,
      destinationType: this.camera.DestinationType.DATA_URL,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE,
    };

    this.camera.getPicture(cameraOptions).then((imageData) => {
      // imageData is either a base64 encoded string or a file URI
      // If it's base64:
      this.captureDataUrl = 'data:image/jpeg;base64,' + imageData;
    }, (err) => {
      // Handle error
    });

And then uploading the image in firebase storage


import * as firebase from 'firebase';
  let storageRef = firebase.storage().ref();
    // Create a timestamp as filename
    const filename = Math.floor(Date.now() / 1000);

    // Create a reference to 'images/todays-date.jpg'
    const imageRef = storageRef.child(`myname/${filename}.jpg`);

    imageRef.putString(this.captureDataUrl, firebase.storage.StringFormat.DATA_URL).then((snapshot)=> {
      // Do something here when the data is succesfully uploaded!
     });

I am getting an error as

abc.html:217 ERROR Error: [object Object]
    at viewWrappedDebugError (vendor.js:9858)
    at callWithDebugContext (vendor.js:15104)
    at Object.debugHandleEvent [as handleEvent] (vendor.js:14681)
    at dispatchEvent (vendor.js:10058)
    at vendor.js:10672
    at HTMLButtonElement.<anonymous> (vendor.js:40181)
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (vendor.js:4974)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
anup5708commented, Feb 12, 2018

Hi there,

I just managed by writing the below code:

Html File <input type="file" (change)="registerNewCandidate($event)" />

Source Code

firebase.storage().ref().child('myupload/mountains.jpg').put(event.srcElement.files[0]).then(function(snapshot) {
      snapshot.downloadURL;
});

I hope this help

4reactions
codediodeiocommented, Apr 1, 2018

@BluebambooSRL I’m the guy that wrote that post. I also use the same basic process here https://angularfirebase.com/lessons/google-cloud-vision-with-ionic-and-firebase/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase gives "ERROR error [object Object]" when trying to ...
I'm trying to upload an image to Firebase storage but it's hitting me with a highly-descriptive ERROR Error: "[object Object]" .
Read more >
Error when uploading or downloading images from IBM Cloud ...
Problem. When you attempt to upload or download an image from Cloud Object Storage to PowerVC, you might see the following errors.
Read more >
Error Message: There are errors below. Hover over each for ...
Troubleshooting errors while uploading an image to the Library. We're sorry you're having trouble uploading an image!
Read more >
Error Responses - Amazon Simple Storage Service
Error Code Description HTTP Status Code AccessControlListNotSupported The bucket does not allow ACLs. 400 Bad Request AccessDenied Access Denied 403 Forbidden BucketAlreadyOwnedByYou 409 Conflict (in all...
Read more >
Upload objects from a filesystem | Cloud Storage - Google Cloud
Note: If you are using the Chrome browser, folder uploads are also supported. To learn how to get detailed error information about failed...
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