GithubHelp home page GithubHelp logo

Comments (5)

nadavs avatar nadavs commented on May 18, 2024

Thank you for reporting this issue. We will look into it.
Can you please share the code that reached the HTML response of the 500 error?

from cloudinary_npm.

laurynas-karvelis avatar laurynas-karvelis commented on May 18, 2024

Thank you! I will do that in the evening as currently have no access to my project from work. Btw, best practise would be to assume that everything could break especially when communicating with external resources (in this case - your HTTP API).

As the error fires in one of the response event callbacks, end developer does not have any control to make it fail-save as it the event callback fires out of try catch scope :(.

from cloudinary_npm.

laurynas-karvelis avatar laurynas-karvelis commented on May 18, 2024

The issue which was causing your servers to respond with HTTP 500 status code was that for some reasons binary buffer which I was sending upload_stream()'s object was saved as your temp file in FS, but was not able to process it further properly:

exports.sampleExpressJsAction = function(req, res) {
  var stream = cloudinary.uploader.upload_stream(function (response) {
    // before coming here it dies with error mentioned in my original issue comment
    console.log(response);
  });

  req.on('data', stream.write);
  req.on('end', stream.end);
};

...but... if I save the Buffer first into file and then re-read it passing into upload_stream() stream object in the same manner it WORKS! Completely bizzarre...

Both buffer objects (request and file's) are identical. Have no clue why does it happen.

from cloudinary_npm.

laurynas-karvelis avatar laurynas-karvelis commented on May 18, 2024

Fixed in #9

from cloudinary_npm.

nadavs avatar nadavs commented on May 18, 2024

Thank you for all your contributions and for sharing the code. The pull requests were merged into the master branch and are part of the latest released v1.0.1 of the NPM.
We will make sure that the service avoids returning HTML responses for API requests.

from cloudinary_npm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.