Deploying Frontity - Internal Server Error

I have been trying to deploy my Frontity App on both Vercel and Layer0 according to the instructions in the docs. But there seem to be some instructions missing.
I get a message from Layer0 that the app has been deployed but when I go to the test link it says “Internal Server Error”. Same with Vercel.

I change my domain before the build in frontity.settings.js to the domain where my Wordpress is hosted live.

Am I supposed to do something more than the steps in the instructions for deployment?

@s74 Could you share a repo with your code to see better what is going on?
Did you check that your WP endpoint is open and returns the required data for Frontity to work?
Does your project work on local? If not, do you get any logs?

The more info you provide, the better for us to help you :slight_smile:

Ok, thanks! Here is my repo:

It works on local if I run “npx frontity dev”

But if I just try the build localhost it says “Internal Server Error”

Hi @s74 ,

For what I could gather after a quick look, you are setting the state.source.url to localhost (FED20Examensarbete/frontity.settings.js at 9ff0b19fe6b3d3aaf6bc40801e933f2fd0c9016d · susanneeneroth/FED20Examensarbete · GitHub), because I’m guessing you have a local WP env. But in production you need to point to the WP you have hosted.

So, to be clear, with Frontity you need two servers, one hosting WP itself, and another one hosting Frontity.

You can use the process.env.NODE_ENV variable to check if you are running on dev or prod mode in the frontity.settings.js file, and depending on the value you can set state.source.url to the dev or prod value.

Let me know if you need more help.

Thank you for your reply!

I tried my hosted WP url as well, but get the same error.

Sorry, I am quite a newbie, so I don’t know how to check in process.env files :slight_smile: .

How do I do that?

Can you share your hosted WP url? It would help to debug this locally.

About process.env it is a feature of Node.js: Process | Node.js v16.15.0 Documentation
In that object you can read environmental variables, but if your hosted WP url is not working, this is not going to help :slight_smile:

My hosted url is https://www.susanneeneroth.se/

I got a message from Vercel now that I should configure the domain with name servers. But I don’t know if this will solve the issue, since the issue is also on localhost.

Hi @s74 ,

For what I could see, you don’t have your hosted WP configured with all the required endpoints you are using in Frontity.

For example, https://www.susanneeneroth.se/wp-json/wp/v2/contact-footer does not exist yet.

So the cause of your issue is most probably some data missing that is throwing an error inside some React component.

Once you setup your hosted WP and use its url in state.source.url you should be good to go.

You can always debug this running your site in local but using the hosted WP url, and you will see in terminal what errors you get, and that will help you figure out where the issue is.

Hi!

Thank you for taking your time to help me again :)!

But I have activated the plugin in the hosted WP. How do I configure endpoints?

I’m afraid I cannot help you with that :frowning:. You should check the docs of your plugin and see what endpoint they are exposing and how to configure it.

If the local WP is working with Frontity, try to replicate exactly what you have on your local in the hosted WP.