500 status on preview mode


First of all, I want to thank the Frontity team, building WP websites has become a lot more enjoyable.

I’m running into problems when trying to preview pages. I keep getting Internal Server Error status 500.

My environment is:
• Frontity project is set inside a folder in the theme folder (it’s a monorepo).
• I’m using Apache to serve both WP and Frontity locally. .htaccess settings added to WP root folder and a simple ProxyPass / http://localhost:3000/ for serving the node server (there’s also a self-signed SSL certificate set on both, so I can run things through https).
• Frontity is being served at https://dev.prototype.com and WP at https://local.prototype.com
• It’s a recent project, so I believe all packages are running on their latest versions.
Frontity Embedded Mode plugin is installed and $frontity_server is set as ‘https://dev.prototype.com’.
–public-path https://dev.chaianalytics.com/static when building frontity

Even though the embedded mode seems to be working just fine, I can’t get to make the pages/posts preview posts work. No matter how I set things, I keep getting:

status: 500,
statusText: ‘Internal Server Error’

When debugging the post revision endpoint through Postman, using the same JWT sent as frontity_source_auth, that’s the result I get:

“code”: “invalid_username”,
“message”: “Unknown username. Check again or try your email address.”,
“data”: null

Apparently, at wp_authenticate_username_password at user.php file in wp-includes the value of $username is {“typ”, which leads to the error above. Curiously, the previews work if I make that function skip errors and return true, but obviously, that can’t go to production.

I thought it could be some issue with my WP REST API not being able to fetch revisions, but the same error doesn’t happen when using Basic Auth on Postman.

Any tips or suggestions are appreciated, let me know if I can provide any more details.

Thanks in advance!

@fabriziotm, welcome to the community :slight_smile:

  1. Could you please deactivate all your plugins and leave only the Embedded mode one to see if any of them are causing the problem?
  2. If you already did that and it keeps failing, please open an issue in the https://github.com/frontity/frontity-embedded-proof-of-concept repository and we will take a look at it.

By the way, I bet you can use http://localhost:3000 in your $frontity_server variable if you are running both Frontity and WordPress in the same server.

Also, make sure to run Frontity using a process manager like PM2 or forever.


Hi Luis,

Indeed, the problem was one of the plugins I was using (WP API SwaggerUI), which is very annoying.

Thank you very much!

1 Like

Awesome, I am glad it is solved now @fabriziotm :slight_smile: