AndreasFaust / gatsby-source-custom-api

Source data from any API and transform it to (File-)Nodes.
52 stars 25 forks source link

Image downloading but not accessible — also bug depending on url. #11

Open a-rbsn opened 4 years ago

a-rbsn commented 4 years ago

Having some difficulty with images and this plugin — there are two main issues I am facing.

Context:

I am using CraftCMS and the ElementAPI to generate a JSON API to use with this plugin.

First bug/issue:

url passed to createRemoteFileNode is either missing or not a proper web uri:

Even though my uri's being passed from craft are like so: /assets/images/L1000642ACR.jpg — it fails to detect/download the image, this appears to match what is in the docs.

To test some things out I appended the site URL to the API so it gave the full URL of the image — this allowed 2 out of 3 test images to download but the third still failed, I can only assume it's something to do with the filename of the image which is quite long and has differing characters within it:

url passed to createRemoteFileNode is either missing or not a proper web uri: http://livvy-cms.test/assets/images/home/Different-Interruptions-of-Dust-41x28cm-photogravure-print-etchin
g-paper-gold-ink-2016-of-the-1979-eruption-of-the-Soufrière-Volcano.jpg
Image downloaded: Post-Card-Image.jpg
Image downloaded: Different-Interruptions.jpg

This isn't ideal for production as the client could upload any image with any filename. Edit: This is definitely because of the french character è in the filename, not sure how to resolve as of yet.

Second bug/issue

Taking the partial success of the two images that did download — I went into Graphql to see if it had worked. The images downloaded to Gatsby's cache which I assume is correct, but in GraphQL I have no access to:

                    childImageSharp {
                        fluid(maxWidth: 2000) {
                            ...GatsbyImageSharpFluid_withWebp
                        }
                    }

on the local node — any ideas/suggestions would be great.

Edit: I didn't have either sharp plugin installed... hence the images weren't available in GraphQL — worth mentioning in docs? The image name thing is an actual bug though.

MuhammadHadiofficial commented 3 years ago

Did you fix the issue? I Am facing same issue with Gatsby 3 images are downloaded but not accessible from graphql

benslv commented 3 years ago

Also having this issue, I think. The console displays that the images have been downloaded, but GraphQL shows the node as null.

image

a-rbsn commented 3 years ago

@benslv — I'm trying to use this plugin on a new site, I'm currently in the situation where I can have all of my data related (conference->event->image) and have the image unaccessible, or have my data separate (conference, event->image) and have the image accessible. I feel like this plugin hasn't been maintained for Gatsby 3.

MuhammadHadiofficial commented 2 years ago

I think thats because this plugin was not updated to new breaking changes of gatsbyv4?