When using the downloadLocal option with the Contentful plugin, publicURL is missing from localFile.
When checking GraphiQL, I see absolutePath which points to the cache folder (as mentioned in the docs) along with a whole lot of other fields, and I can query childImageSharp which returns a valid url, but publicURL is nowhere to be found.
https://github.com/sebpettersson/gatsby-contentful-bug
Clone this, install dependencies, run gatsby develop, open http://localhost:8000/___graphql`.
See that publicURL is missing under contentfulGatsbyTest > imageField > localFile
NOTE: While setting up this test case, I noticed that sometimes the whole localFile field was missing - reinstalling the dependencies fixed this _some of the time_ (deleting .cache did not). Maybe that's another bug, or maybe it's related to the above.
publicURL should point to an image file on the local file system.
publicURL is missing.
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.3 - /usr/local/opt/node@10/bin/node
Yarn: 1.19.2 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/opt/node@10/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 78.0.3904.108
Firefox: 70.0
Safari: 13.0
npmPackages:
gatsby: ^2.18.4 => 2.18.6
gatsby-source-contentful: ^2.1.66 => 2.1.66
npmGlobalPackages:
gatsby-cli: 2.8.14
I replicated this locally and confirmed that publicUrl is not available on localFile even with downloadLocal: true in config.
I ran into the same problem
"gatsby": "^2.18.6",
"gatsby-plugin-react-helmet": "^3.1.16",
"gatsby-plugin-robots-txt": "^1.5.0",
"gatsby-source-contentful": "^2.1.66",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1"
Thank you for opening this!
You need to install gatsby-source-filesystem. See: https://github.com/gatsbyjs/gatsby/issues/4993
We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!
Thanks, that worked!
Maybe the docs should be updated with that info?
gatsby-source-filesystem is mentioned there, but it isn't at all clear that an extra plugin is needed to access publicURL. Especially since ./cache/gatsby-source-filesystem/ exists even without that plugin.
Here's a plugin with just the copying logic from gatsby-source-filesystem
https://www.gatsbyjs.org/packages/gatsby-transformer-remote-filesystem/
Most helpful comment
Thanks, that worked!
Maybe the docs should be updated with that info?
gatsby-source-filesystemis mentioned there, but it isn't at all clear that an extra plugin is needed to access publicURL. Especially since./cache/gatsby-source-filesystem/exists even without that plugin.