cloudinary-community / gatsby-transformer-cloudinary

Use Cloudinary images with gatsby-image for high performance and total control!
https://gatsby-transformer-cloudinary.netlify.app/
MIT License
69 stars 28 forks source link

Improve error logging #4

Closed mduecker closed 4 years ago

mduecker commented 5 years ago

Could we add more detail to the error messages (during build)? If this is something that can be done within the plugin, I'm happy to work on a PR for this.

Errors: Request failed with status code 404

GraphQL request:8:13 7 | childImageSharp: childCloudinaryAsset { 8 | fluid { | ^ 9 | ...CloudinaryAssetFluid,Request failed with status code 404

jlengstorf commented 5 years ago

Yeah, we should be able to catch errors from Cloudinary's SDK and axios requests to output more helpful errors. Let me know if you have any questions as you dive in! Looking forward to your PRs. Thanks for being willing to help!

masives commented 5 years ago

Hi, I also faced such issue. image

However printing node for the issue helps with debugging as it turned out the file that plugin was trying to transform was incomplete. @jlengstorf please tell me if you feel this is sensible and I'd add reported info with the node that has problem.

EDIT: after some more experimentation on processing images from wordpress blog (~160 posts, ~430 assets). I've faced a number of errors:

The only way to make the build work was to not create nodes when upload to cloudinary failed (but you still cannot use these resources so it solved nothing).

On each build attempt few files (too big + invalid for some reason) fail on regular and some seem to fail on random.

Chuloo commented 4 years ago

Added a try/catch to the Cloudinary uploader so errors from uploads are logged. The rest of the errors I believe are handled by Gatsby. Also, @masives, the errors with uploading multiple images are fixed in #21. With the breakpoints, you can specify custom min and max breakpoints in the gatsby-config.js options for the plugin.

@mduecker kindly re-open this issue and suggest any other error logging enhancements if any and we'll be sure to put them in. Closing this for now :)