Create a new project and get 404 error of the site

Greetings. I am configuring a frontity for one of my blogs in wordpress, it happens that when I am going to execute the development that is to say when executing the frontity dev command it is created well, it does not give error, but when accessing the site in frontity, it gives 404 error, and in the console I get this notification:

{FetchError: invalid json response body at https://vivalacocina.com/wp-json/wp/v2/posts?_embed=true&page=1 reason: Unexpected token? in JSON at po
sition 0
    at eval (webpack-internal: ///./node_modules/node-fetch/lib/index.mjs: 276: 32)
    at process._tickCallback (internal / process / next_tick.js: 68: 7)
  message:
   'invalid json response body at https://vivalacocina.com/wp-json/wp/v2/posts?_embed=true&page=1 reason: Unexpected token? in JSON at position 0 ',
  type: 'invalid-json'}

I have noticed that this happens with blogs in which I use a “Genesis” theme, I have another that does not use that theme and it works correctly. How can I solve that error and that the frontity works in those blogs that use the theme “Genesis”. Greetings.

Hi there, @rbatistaleguen! :wave:

I’ve been doing some debugging and It looks that a strange character with code '65279' is been included at the beginning of the response’s body. It doesn’t happen in the browser, though, only when using fetch in the server… :thinking:

I’m going to investigate further.

Okay David :+1:, I hope your solution to the problem, I appreciate the support. regards. :handshake:

By the way, @rbatistaleguen, did you tried to change your theme by a “non-Genesis” one in those sites in which you are using “Genesis”? Have you confirmed that it works when you do that?

Yes David, I did it, and keep giving the same error

David, there is a detail, the collation of the wp_posts table in the Genesis themes changes to utf8mb4_unicode_520_ci, before installing the Genesis theme had latin1_swedish_ci.

Hello again, @rbatistaleguen :wave:

I has been a while since the last post, sorry about that. :sweat_smile:

If the problem is actually related to the Genesis theme, then there is little we could do. In the end, the theme is not important when moving to Headless WordPress: the Frontity theme will completely replace the theme you’re using in your WordPress site.

Apart from that, you can try to change the collation of that table maybe? Or test Frontity with a different version of Node.js, just in case…

Anyway. If you need help with something else just let us know, we’ll do our best to find out a solution.

Cheers!