Iāve been testing Frontity with a local instance of Wordpress and have been able to grab data from posts, pages, etc so far. I have a Wordpress instance set up publicly (not ssl/https) and am testing grabbing data from the public test Wordpress instance. Upon doing this and attempting to actions.source.fetch(āhome-postā) I constantly receive an error in my console that is presented as the name of this post: āServerError: post type from endpoints āposts, pages, mediaā with slug āhome-postā not foundā.
My frontity.settings source url is āhttp://test.pritchardelectric.net.user.server296.com/ā. Iām not using the wp-json appended considering I didnāt need to do this to receive data from my localhost wordpress instance. And I receive an error with that appended any ways (different error).
Iām viewing the network response, and am receiving an empty array from āhttp://test.pritchardelectric.net.user.server296.com/wp-json/wp/v2/posts?_embed=true&slug=home-postā
When I go to this url directly in browser I can see the expected json associated, which is weird Iām not receiving data back in the network response from the actions.source.fetch.
Not sure why this is working on local and not public. I have the same post name/permalink on public, and same permalink types set globally. Iām calling actions.source.fetch in a use effect within my Home.js component.
The repo is private. So please let me know if you have any questions. Thank you so much in advance.
WP Rest API URL is the site with /wp-json appended
Hi @vensoneandrew
Welcome to the Frontity community.
We regret that we cannot provide support if your repo is private. Frontity is open source software and we would like the answers we provide in this forum to be of benefit to all developers working with Frontity.
If you can reproduce your problem in a project that is in a public repo then we will be happy to try to help.
1 Like
Hi! Thank you for the reply. The repo is now public. The fetch is being made in the home component.
Please let me know if you may have any questions
Hi @vensoneandrew
Thanks for making your repo public. Iāve cloned your repo but unfortunately I canāt reproduce your error. As you can see from the screenshots below Iām getting the data for home-post
in the state and Iām not receiving the error that youāre getting in the console.
As you can see the above corresponds with the data received from the URL you provided:
Hm very interesting. I didnāt update the latest code that has the url of the site in frontity.settting.js source url. Unfortunately our power is out here in Texas, and I didnāt push new commits beforehand. Iām assuming you replaced the source url with the public wp site and were able to retrieve this data. You didnāt receive any errors in the console? Very strange.
I was able to navigate the json data before as well within the browser, but received an error in console that frontity wasnāt able to retrieve any posts from that slug. Whenever our power comes back on Iāll check to see if it is working on my end. Thank you for looking into this!
Hi @vensoneandrew
Yup, I figured that http://localhost/pedev
wasnāt going to cut it for me!
I did get errors, but they were for things like faq
and gallery
, i.e. items in the menu which are links to pages that donāt seem to exist in the json returned from the REST API so I didnāt worry about them. I didnāt get the error about home-post
- clearly, because Iām getting the data.
Good luck with resolving this, and hope the power comes back soon. Let me know if you need to run anything else past me.
Thank you for looking into this. Power came back on, and tested site. It is indeed working. Not sure why I got those errors at first. Maybe it took a while for the new post to be reflected in wordpress or something ā¦ not entirely sure. Thank you!
1 Like