-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-plugin-sharp] allImageSharp not getting all nodes #4843
Comments
To add some more info: it doesn't necessarily only generate the last image (I was only testing with two images). When I added more images, some of them were generated while some others were not. I've tried deleting the cache, node_modules, the public folder etc. I can sometimes get the images the generate if I move the files around or delete them and then readd, but its not consistent. Also, even if I do end up getting them to generate for all of the images, my graphql query only returns the ones that were initially generated and not the ones I randomly got working later. However, I see all expected nodes on GraphiQL. I've cleared my browser cache with no luck. |
Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help! |
@jweinstein92 did you ever solve your problem? I am running into the exact same issue right now using the following query. I have main_1 -> 4 .jpg in the folder and it only return 2 and 4. If I mess around with the query it might return 1 and 4 or some other subset but it only ever seems to return 2 of the 4 images.
|
Description
I am having difficulties making sure the images I am trying to use are generated. Essentially, I have a bunch of pages created using
createPages
ingatsby-node.js
. Through this process, I pass in a Javascript regex into the context. In the template file, I want to use that regex to find all images that match that regex and then display those images on the page. I am able to use the regex, but the number of nodes I get is not the number of nodes I expect. Looking into it, I noticed that only the last image that matched the regex was added to the public/static folder.Steps to reproduce
I have a directory
src/img
with a bunch of images in the form a_1.jpg, a_2.jpg, a_3.jpg, b_1.jpg, b_2.jpg etc.In my
gatsby-config.js
file i have included gatsby-source-filesystemIn one of my templates (used with createPage) I have the following GraphQL query.
$photo_regex
is a defined Javascript RegExpI've used this kind of query before elsewhere on a single image and it works as expected.
Checking GraphiQL with the following query will show me the correct number of nodes
Expected result
I would expect GraphQL to iterate over all of the images that match the regex and generate appropriate sizes for all images.
Actual result
Only the last image that matched the query generated images in the
public/static
directory.Environment
npm list gatsby
): 9.238gatsby --version
): 1.1.50File contents (if changed):
gatsby-config.js
:gatsby-node.js
:The text was updated successfully, but these errors were encountered: