-
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-source-wordpress] No localFile field on images in ACF fields #2492
Comments
It's hard to say without seeing a working example of this problem. Could you create a small site reproducing this problem and push it to Github that we could play with? FWIW, this is the exact setup on the using-wordpress example site
|
@KyleAMathews here you go. This is using all the same versions as on my main project but I have just created a shell wordpress install. Just need to install wordpress via composer and point a virtual host at it. I have included the query I ran in the readme |
I don't have composer running on my machine :-) Could you put the wordpress on a free host somewhere? Also, feel free to take a crack at solving the issue yourself — check out the data in This is where files are downloaded
Perhaps ACF has multiple ways of creating file attachments where we're only handling media? |
@KyleAMathews I haven't really got time to be setting up hosting. I've committed everything to the repo so all you need to do is point a virtual host at it and setup and import database. It is downloading the media files from acf fields to Also it seems to be generated correctly in
That appears to have the localFile mapping but it does not show in graphiql |
I have the same issue, if there's no WP site up by tomorrow I can put a non-working example up for you.. unfortunately can't do it until tomorrow though 👍 |
Cool, so... Gatsby: https://github.com/chrisgeary92/gatsby-wp-acf-media-issue Example query:
You can't access If you need anything more, just let me know :) |
@chrisgeary92 that's awesome thanks for sorting that out! :) |
As of yet, fields named We could extend the naming conventions to a greater number of field names that would be reserved for photos, like |
* Most of the credits goes to @pieh for a better solution that solved the same problems and widely improved code simplicity. #2646 * Made the Media lookup begin at JSON tree root instead of keeping this for ACF Field only. Changed constants names accordingly. * Making thise more generic allorws Custom Post Types to benefit from this improvements and yet unseen objects shapes. * Incorporated fix on bug mentionned here #2646 (comment) * May solve this #2587, this #2492, this #2328
#2648) * Refactored featured_media map for deep nodes * Featured medias coul be nested at any level * The most certain way to have photos works with this version on the plugin is to either name the fiel featured_media or include the image as Post Object. * Fixed bug where in some case the old featured_media field was not deleted. * Update normalize.js.snap * Integrated pieh 's changes * Most of the credits goes to @pieh for a better solution that solved the same problems and widely improved code simplicity. #2646 * Made the Media lookup begin at JSON tree root instead of keeping this for ACF Field only. Changed constants names accordingly. * Making thise more generic allorws Custom Post Types to benefit from this improvements and yet unseen objects shapes. * Incorporated fix on bug mentionned here #2646 (comment) * May solve this #2587, this #2492, this #2328 * Update normalize.js.snap
I am running into this too at the moment... Installed everything new, still no localFile Node :( |
@flmuel does the WordPress example site work for you? |
@KyleAMathews yes the example works... |
Does your WordPress site have attached files? Gatsby dynamically creates the schemas from your data source(s). |
Do you mean by attached files the media files that are connected with the acf fields? If yes, than I can confirm your question... The acf image fields are Media-Urls and not Objects or Ids. |
Tried a kindy hacky alternative: I have placed the same images that are connected with the fields in WordPress in the Gatsby static folder. Now I am requiring the right image with "directory" + node->acf->image->slug + ".jpg" It works and builds, but I do not like this solution... Netlify does not like this either and terminates the build process after:
|
Netlify works now, was an issue with yarn and sharp I think ... npm did the thing... but no localFile for me yet :( |
So I have tracked this problem further down...
something after this broke...
which gave me this for each file:
You can see that the output says "auth: null" - so I really think thats the matter of my issue (maybe not linked to this acf issue)... |
WordPress Source normalize.js: got package: |
Ahhhhh! So we need to pass auth headers to createRemoteFileNode! Could you work on a PR passing the right auth headers to |
I dont know how... |
The wordpress auth instructions will need translated to HTTP headers similar to what's done in https://github.com/gatsbyjs/gatsby/blob/2bda70e3dd2b32499ee3fe9838dcd74fd570ace3/packages/gatsby-source-wordpress/src/fetch.js
|
Basic Auth fixed! |
I'm starting to experience this on a public API - no basic auth. How should I start to track it down?
|
Try the Link acf type, or anything that can send an image Object. |
@bkonkle Please create a new issue |
@crgeary @KyleAMathews @garytokyo if this is at all still relevant, I think I figured out the root cause: |
@Khristophor added troubleshooting guide that addresses this issue in #6807, so I'll close it. Feel free to re-open or open new issue if following new docs doesn't fix issue for You |
…shooting information (gatsbyjs#6807) Addresses gatsbyjs#6273 and gatsbyjs#2492 by including information for a temporary workaround until the issue is patched in WordPress core.
For me
|
Thanks, this help me on my issue! Somebody know how to create a filter on WordPress when the user upload one photo type attachment the post_parent with value 0 by default? Cheers! |
Thank you @MWalid. That fixed it for now. :) @lpluispacheco did you find a solution for the filter already? EDIT: no I was wrong. I just have the problem again. |
The WP-Plugin https://de.wordpress.org/plugins/media-library-assistant/ offers the feature to bulk set |
@lauritowal Same here, for me it just comes up during the night time, but I don't see any interesting issue in my server logs. I will call my hoster, maybe it is related to resources. |
Hi @radscheit For me using |
@lauritowal Thank you very much, saved my life! :) |
Stupid question.. But how? :D |
Did it help you? |
|
I was using the wordpress example site to work out how to use Sharp and got it working fine with allWordpressWpMedia or any wordpress Media query but on ACF it does not work in the same way. localFile just doesn't appear as an option in the graphql schema for ACF image fields. That seems to be the way it is being done in the example.
Example query below:
I'm wondering if this could be due to the same issue as my previous ticket when ACF fields couldn't be queried if some pages/posts didn't have them.
The text was updated successfully, but these errors were encountered: