vips2png: "unable to write to target" error when generating thumbnails breaks the build
See original GitHub issueDescription
During the build step, this error happens
vipspng: libpng read error vips2png: unable to write to target
Please, could you provide me with a way to debug which image might be breaking vips2png (used by sharp plugin)? We have a thousand of them
The error happens in CircleCI, and it’s difficult to replicate in our local because of x number of reasons.
More context:
info bootstrap finished - 39.546s
warning
[] 0/96 0.0 s 0% Generating image thumbnailswarning
The requested height "500px" for a resolutions field for
the file /home/circleci/project/.cache/caches/gatsby-source-drupal/7f6345e68e32e87cf256a6dbc8a1b279/example.png
was larger than the actual image height of 330px!
If possible, replace the current image with a larger one.
[] 0/135 0.0 s 0% Generating image thumbnails [] 0/182 0.0 s 0% Generating image thumbnails [] 0/185 0.0 s 0% Generating image thumbnails [] 1739/1749 34.5 s 99% Downloading remote files [] 1741/1749 34.6 s 99% Downloading remote fileserror There was an error in your GraphQL query:
vipspng: libpng read error
vips2png: unable to write to target
57 | langcode
58 | title
59 | created
60 | path {
61 | alias
62 | }
63 | relationships {
64 | field_recipe_image {
65 | localFile {
66 | childImageSharp {
> 67 | fixed(height: 500)
| ^
68 | ...GatsbyImageSharpFixed_withWebp
69 | }
70 | }
71 | }
72 | }
73 | }
74 | }
75 |
76 | query ListingQuery {
77 | allNodeProductPage {
File path: /home/circleci/project/src/components/Listing.js
Plugin: none
not finished run queries - 3.854s
not finished Generating image thumbnails - 3.828s
Steps to reproduce
Sorry, not easy to reproduce, since I’m trying to pinpoint what PNG image is the one that is breaking sharp plugin (specifically, what is breaking vips2png ) It seems it’s an open issue https://github.com/libvips/libvips/issues/1578
Expected result
Build succeeds.
Actual result
Build breaks.
Environment
System:
OS: macOS Mojave 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.12.0 - /usr/local/bin/node
Yarn: 1.19.1 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Languages:
Python: 2.7.17 - /usr/local/bin/python
Browsers:
Chrome: 83.0.4103.61
Firefox: 75.0
Safari: 12.1.1
npmPackages:
gatsby: ^2.22.3 => 2.22.3
gatsby-background-image: ^1.1.1 => 1.1.1
gatsby-image: ^2.4.5 => 2.4.5
gatsby-plugin-client-side-redirect: ^1.1.0 => 1.1.0
gatsby-plugin-manifest: ^2.4.8 => 2.4.8
gatsby-plugin-meta-redirect: ^1.1.1 => 1.1.1
gatsby-plugin-offline: ^3.2.6 => 3.2.6
gatsby-plugin-react-helmet: ^3.3.2 => 3.3.2
gatsby-plugin-sharp: ^2.6.8 => 2.6.8
gatsby-plugin-styled-components: ^3.3.2 => 3.3.2
gatsby-source-drupal: ^3.5.7 => 3.5.7
gatsby-source-filesystem: ^2.3.7 => 2.3.7
gatsby-transformer-json: ^2.4.3 => 2.4.3
gatsby-transformer-sharp: ^2.5.3 => 2.5.3
npmGlobalPackages:
gatsby-cli: 2.8.18
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:23 (8 by maintainers)
Top Results From Across the Web
updating gatsby-plugin-sharp from 2.8.0 to 2.9.0 breaks build
updating gatsby-plugin-sharp from 2.8.0 to 2.9.0 breaks build. ... state vips2png: unable to write to target target Error: pngload: ...
Read more >libspng/community - Gitter
I'll make a point release soon if nothing else comes up ... invalid chunk length pngload: end of stream vips2png: unable to write...
Read more >Strange behavior in pyvips, impossible to write some images
I found your error message in libspng: https://github.com/randy408/libspng/blob/master/spng/spng.c#L5989. It looks like it's being triggered ...
Read more >Ultra-Fast Thumbnail Generation with Jekyll and libvips
Generating thumbnails with libvips is nearly 10x faster than smartcropper. Ten. Times. Faster. Full site builds now take < 4 seconds in devlocal ......
Read more >Using vipsthumbnail - libvips
You can set the bounding box of the generated thumbnail with the --size option ... You can append ! to force a resize...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Traced down the root source of the error & catch the error and print out which file is causing the problem https://github.com/gatsbyjs/gatsby/pull/28614
Thanks @ascorbic. It’s happening randomly, some of the builds are green. We are thinking it could be some of the images are huge, 40Mb could error silently. We will try to narrow down the issue.