prismicio / prismic-client

The official JavaScript + TypeScript client library for Prismic
https://prismic.io/docs/technical-reference/prismicio-client
Apache License 2.0
169 stars 61 forks source link

Error: failed to process and failed to download images from prismic #150

Closed ClarissaW closed 3 years ago

ClarissaW commented 3 years ago

Hi Prismic team,

I am using gatsby-source-prismic for my website. This website will be used by users who is in another country, currently it is slow when accessing images. So i am trying the approach of downloading the images locally and use graphql to query localFile. However, I'm getting the following errors while downloading the images. Not all images have the problem, i checked a few images, they are all larger than 1 megabytes.

Error: failed to process https://images.prismic.io/my-repo/b1dcefa1-0f8b-4622-866b-4947ec297156_id.jpg Failed to download https://images.prismic.io/my-repo/b1dcefa1-0f8b-4622-866b-4947ec297156_id.jpg after 3 attempts

Due the failure of downloading these images, localFile is null so I am getting the error
WebpackError: TypeError: Cannot read property 'childImageSharp' of undefined when i try to access image fluid via myImage.localFile.childImageSharp.fluid

My setting for downloading images shouldDownloadImage: ({ node, key, value }) => { // Return true to download the image or false to skip. return true },

dependencies

"dependencies": { "bootstrap": "^4.5.2", "emailjs-com": "^2.6.3", "gatsby": "^2.24.61", "gatsby-background-image": "^1.3.1", "gatsby-image": "^2.4.19", "gatsby-plugin-manifest": "^2.4.30", "gatsby-plugin-offline": "^3.2.28", "gatsby-plugin-react-helmet": "^3.3.11", "gatsby-plugin-sass": "^2.3.13", "gatsby-plugin-sharp": "^2.6.36", "gatsby-source-filesystem": "^2.7.0", "gatsby-source-prismic": "^3.2.1", "gatsby-transformer-json": "^2.4.13", "gatsby-transformer-sharp": "^2.5.15", "jquery": "^3.5.1", "node-sass": "^4.14.1", "prop-types": "^15.7.2", "react": "^16.12.0", "react-bootstrap": "^1.3.0", "react-dom": "^16.12.0", "react-helmet": "^6.1.0", "react-icons": "^3.11.0", "react-markdown": "^4.3.1", "react-scroll": "^1.8.1" }, "devDependencies": { "@babel/core": "^7.11.6", "@babel/preset-react": "^7.10.4", "@babel/register": "^7.11.5", "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", "eslint": "^7.9.0", "eslint-plugin-react": "^7.21.1", "gh-pages": "^3.1.0", "intern": "^4.8.7" },

ClarissaW commented 3 years ago

Any insights?

lihbr commented 3 years ago

Hey @ClarissaW, I'm really sorry we failed to give you any attention back then.

@angeloashmore can you have a quick look / knowing if this had been addressed in the next version of the Gatsby plugin and close if necessary?