Heroku: npm ERR! Missing script: "start"

I added required line to the package.json as “start”: “frontity serve --port $PORT”,
But I am still getting issues with the deployment of my app on Heroku.

My previous deployment was on vercel but for some reason, I am getting a timeout error.
This Serverless Function has timed out.

Your connection is working correctly.

Vercel is working correctly.

504: GATEWAY_TIMEOUTCode: FUNCTION_INVOCATION_TIMEOUT

Thanks for the help

Hi! This normally happens because the WordPress server is taking a long time to respond to the Heroku server. First of all, if it happens always on a certain page, I would check if that page is calling a WordPress endpoint that is having and error, infinite loop or something like that.

But in most of cases It can be because a certain endpoint is just slow due to server overload or a complex query and, unfortunately, the free tier of Heroku has short response time before it through the error.

Two solutions to solve this can be:
· Upgrade to a higher Tier in Heroku (it happened the same to me in Vercel and when I upgraded, the problem were solve)
· Cache the results of the WordPress API to reduce the load of the server and serve it faster (WP REST Cache – WordPress plugin | WordPress.org or Simple Cache – Plugin WordPress | WordPress.org España)