Lepozepo / cloudinary

MIT License
94 stars 42 forks source link

Callback is not firing #85

Closed sardormajano closed 7 years ago

sardormajano commented 8 years ago

Hi! I am having trouble with uploading pics into Cloudinary Cloudinary.upload(files[0], { folder }, function(err, res){ console.log('upload error: ' + err); console.log('upload result: ' + res); }); though the settings are correct. When the method is run, nothing happens: no callback, no image on my cloudinary cloud. Could you please help me with that?

gorgekara commented 8 years ago

Same happens for me as well - i'm getting this error in Chrome Console

Exception in delivering result of invoking 'c.sign': TypeError: Cannot set property '_id' of undefined
    at http://localhost:3000/packages/underscore.js?hash=27b3d669b418de8577518760446467e6ff429b1e:892:21
    at Array.forEach (native)
    at _.each._.forEach (http://localhost:3000/packages/underscore.js?hash=27b3d669b418de8577518760446467e6ff429b1e:149:11)
    at Function._.extend (http://localhost:3000/packages/underscore.js?hash=27b3d669b418de8577518760446467e6ff429b1e:889:5)
    at http://localhost:3000/packages/lepozepo_cloudinary.js?hash=65d4e2aebbaa7d8363e67b5d169b244020afe734:1158:20
    at ._callback (http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:1105:22)
    at _.extend._maybeInvokeCallback (http://localhost:3000/packages/ddp-client.js?hash=b5f1b97df6634673c68f37914ae9f4c3231c438e:3541:12)
    at _.extend.receiveResult (http://localhost:3000/packages/ddp-client.js?hash=b5f1b97df6634673c68f37914ae9f4c3231c438e:3561:10)
    at _.extend._livedata_result (http://localhost:3000/packages/ddp-client.js?hash=b5f1b97df6634673c68f37914ae9f4c3231c438e:4681:9)
    at onMessage (http://localhost:3000/packages/ddp-client.js?hash=b5f1b97df6634673c68f37914ae9f4c3231c438e:3369:12)
Lepozepo commented 8 years ago

Mmm, I think the latest PR might have brought in some issues. I'm patching it after work today ^_^.

Lepozepo commented 8 years ago

Hmm, I can't seem to replicate the issue, do you have a gist or repo I can look at that causes the issue?

Lepozepo commented 8 years ago

Hey guys, I gave the package some love today, try upgrading and let me know if that fixed the issue. ^_^

sardormajano commented 8 years ago

I'll check it out later since I was in a hurry and had to use uploadcare meteor package instead.

johhansantana commented 8 years ago

Hi there, I'm getting the same issue, the callback is not doing anything at all and no images in cloudinary.

client:

class profileImageModalCtrl {
  constructor($scope, $state) {
    'ngInject';

    $scope.checkImage = (file) => {
      console.log(file);

      var files = []
      files.push(file)
      console.log(files)

      $.cloudinary.config({
        cloud_name: "cloudname"
      });

      Cloudinary.upload(files[0], function(err, res) {
        console.log("Upload Error: " + err);
        console.log("Upload Result: " + res);
      });
    }
  }
}

When I execute the function I get the files and everything seems ok, but the callback for Cloudinary.upload doesn't seem to fire or do anything.

Running version: lepozepo:cloudinary@4.2.1

Lepozepo commented 8 years ago

Hey guys, this seems to be an issue with check(). Patching it up in a bit and should be gtg ^_^

Lepozepo commented 8 years ago

All right guys, new version is up, let me know if you're still getting issues

johhansantana commented 8 years ago

I'll give a check this monday, thanks!

johhansantana commented 8 years ago

Jeu @Lepozepo I tested this today after updating to lepozepo:cloudinary upgraded from 4.2.1 to 4.2.2

But still no callback and no image in cloudinary :(

johhansantana commented 8 years ago

I was able to upload successfully by changing:

Cloudinary.upload(files[0],{}, function(err, img) {
  if (err) return console.log('error uploading: ', err);
  console.log('success uploading: ', img);
});

to

Cloudinary._upload_file(files[0],{}, function(err, img) {
  if (err) return console.log('error uploading: ', err);
  console.log('success uploading: ', img);
});

Now I got the call back successfully :D

source: http://stackoverflow.com/questions/31919613/meteor-cloudinary

tomhalley commented 7 years ago

+1 @jsantana90 This worked for me!

Lepozepo commented 7 years ago

Damn, that's so weird! I'll have another look, lol

Lepozepo commented 7 years ago

Lol, @jsantana90, I just noticed that you were passing an individual file to the upload function. The upload function only takes arrays so the solution is to do Cloudinary.upload(files, {}...) instead of Cloudinary.upload(files[0], {}...). I'll push a patch to accept singles as well though ^_^

Lepozepo commented 7 years ago

All fixed in the new version guys