childImageSharp is null for filetypes supported by sharp #28719
Unanswered
olivier-lacroix
asked this question in
Ideas / Feature Requests
Replies: 1 comment 1 reply
-
@KyleAMathews , in response to your message on the original bug report, my understanding looking at the code, is that this option is used to bypass an early exit ( see here ). However, it is not used here; maybe it should? By adding pdf to the supportedExtensions variable, childImageSharp does not return null anymore: it crashes with Not sure what would be the preferred way to handle that. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi there,
I am willing to generate thumbnails for PDF and use them with gatsby-image. Sharp can handle and convert PDFs just fine (when libvips is compiled with PDF support). However, even when setting
checkSupportedExtensions: false
in gatsby-transformer-sharp, childImageSharp returns null.As a workaround, I manually create an intermediary PNG image (using sharp) in a File Node, that can then be fed to gatsby-transformer-sharp. Ideally, this intermediary step wouldn't be required.
Steps to reproduce
Request childImageSharp on a file Node pointing to a PDF file
Expected result
gatsby-transformer-sharp would handle gracefully any format supported by sharp
Actual result
null is returned
Environment
System:
OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Shell: 5.0.3 - /bin/bash
Binaries:
Node: 15.4.0 - /usr/bin/node
npm: 7.0.15 - /usr/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Firefox: 78.5.0esr
npmPackages:
gatsby: ^2.24.91 => 2.29.1
gatsby-image: ^2.4.21 => 2.8.0
gatsby-plugin-manifest: ^2.4.37 => 2.9.0
gatsby-plugin-netlify-cms: ^4.6.0 => 4.7.0
gatsby-plugin-offline: ^3.2.38 => 3.7.0
gatsby-plugin-optimize-svgs: ^1.0.4 => 1.0.4
gatsby-plugin-postcss: ^3.0.4 => 3.4.0
gatsby-plugin-react-helmet: ^3.3.14 => 3.7.0
gatsby-plugin-react-i18next: 0.0.27 => 0.0.27
gatsby-plugin-sharp: ^2.6.43 => 2.11.1
gatsby-source-filesystem: ^2.3.37 => 2.8.0
gatsby-transformer-remark: ^2.11.0 => 2.13.0
gatsby-transformer-sharp: ^2.5.20 => 2.9.0
npmGlobalPackages:
gatsby-cli: 2.15.1
Beta Was this translation helpful? Give feedback.
All reactions