-
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
[wordpress-source-plugin] Self Tag is not returning proper URL #10427
Comments
I can confirm this is happening for me too. The WordPress.com REST API v2 returns a different Old: New: |
## Description As reported in gatsbyjs#10427 some WordPress.com sites return a `_links.$.self` with a fullpath `https://public-api.wordpress.com/wp/v2/sites/$site/users/me` and others without `https://public-api.wordpress.com/`. This means it is not a reliable way of removing the `baseUrl` from the `fullUrl`. Instead we pass the route key in as the `fullPath` rather than the `fullUrl`. We then extract the `basePath` from the `baseUrl` before finally removing the `basePath` from the `fullPath`. We also need to extract the raw entity type from the `fullPath` rather than route. We also need to build the `fullUrl` from `baseUrl` and `fullPath` so I introduced the `buildFullUrl` function to do just that. I’ve included tests for both WordPress.com and WordPress.org. ## Related Issues Fixes gatsbyjs#10427.
Please check this comment - #10624 (comment) for update on the issue - there is open PR but it has some problems for non-wp.com + it really does look like bug on wp.com rest endpoints. In the comment there is link to alternative version of the wordpress plugin that works with those weird wp.com responses in case this blocks you currently |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
…d to fix fetching for wordpress.com hosted sites and proxied urls (#10624) ## Description As reported in #10427 some WordPress.com sites return a `_links.$.self` with a fullpath `https://public-api.wordpress.com/wp/v2/sites/$site/users/me` and others without `https://public-api.wordpress.com/`. This means it is not a reliable way of removing the `baseUrl` from the `fullUrl`. Instead we pass the route key in as the `fullPath` rather than the `fullUrl`. We then extract the `basePath` from the `baseUrl` before finally removing the `basePath` from the `fullPath`. We also need to extract the raw entity type from the `fullPath` rather than route. We also need to build the `fullUrl` from `baseUrl` and `fullPath` so I introduced the `buildFullUrl` function to do just that. I’ve included tests for both WordPress.com and WordPress.org. ## Related Issues Fixes #10427.
Description
I have two apps Using Gatsby JS and the Wordpress-Source-Plugin. One of them is working just fine authenticating and loading the proper WP routes into the GraphQL Schema. This one was created a year or more ago. I also have a newer Wordpress blog that I am using as a data source, however when Authenticating this one I am seeing issues in the Schema. The default route here:
https://public-api.wordpress.com/wp/v2/sites/[WORDPRESS-BLOG]
Normally returns data like this:
However, in my case, on the newly created Wordpress blog, the default indexing path is returning
https://public-api.wordpress.com/
for EVERY Self property.This could be a bug on Wordpress's Side, but the fix for me for now was to change the
getRawEntityType
function infetch.js
to this:While also passing in the path Key to that function on line 615 again in
fetch.js
I can provide a PR with this fix if it is valid, but I could just be missing something simple.
Steps to reproduce
wpcom_app_clientSecret
,wpcom_app_clientId
,wpcom_user
,wpcom_pass
togatsby-config.js
under the Wordpress plugin.gatsby develop
Expected result
The
gatsby-source-wordpress
plugin should pull all data from the routes provided byhttps://public-api.wordpress.com/wp/v2/sites/[WORDPRESS-BLOG]
Actual result
Gatsby loads all of the routes from the same URL, if the self key is not correctly representing the key.
Environment
The text was updated successfully, but these errors were encountered: