-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloudinary service responded with HTTP Code: 500 and HTML instead of JSON #8
Comments
Thank you for reporting this issue. We will look into it. |
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 :(. |
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:
...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. |
Fixed in #9 |
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. |
I've noticed that if your server returns HTTP 500 status code with HTML instead of JSON your npm module exits node.js app completely!
uploader.coffee handle_response and api.coffee call_api tries to parse JSON assuming everything will be fine.
Please add a try catch sections for JSON.parse() there in case your servers are down and responding with non-JSON.
The text was updated successfully, but these errors were encountered: