gatsby-source-wordpress: update node unable to fetch media item due to missing domain #38827
Open
2 tasks done
Labels
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
type: bug
An issue or pull request relating to a bug in Gatsby
Preliminary Checks
Description
After adding a new media item or updating a post with media item, gatsby will try to source updated nodes. However, somewhere in the update node process, it is removing the domain name from the media item urls and keeping the path only, therefore when it tries to fetch the node, a not valid URI error occurs.
This breaks both local development and incremental builds.
I noticed that the the
ensureSrcHasHostname
function has hard-coded logic to add back the domain name, but only if the path starts withwp-content
. If i modify this to suit the path to my uploads folder, it works. I believe that the plugin is removing the domain name as the graphql always responds with full URLs and I am not sure why there is a guard in place to add back the domain name, but only for certain hardcoded paths.I'm wondering whether the best fix is to find out where the domain name is being dropped and preventing that, or allowing custom prefix paths for media items, perhaps in a config.
Reproduction Link
gatsby/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js
Line 116 in bbdddd7
Steps to Reproduce
wp-content
.gatsby develop
...
Expected Result
Fetch media and create/update node
Actual Result
Error occurs when trying to update nodes
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: