ServerError: post type from endpoints "posts, pages, media" with slug "home-post" not found

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! :smile:

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. :man_shrugging:

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