Question

Random 502 error on static website hosted on app platform

I have been dealing with an issue on my personal website, It has been randomly showing a nginx 502 bad gateway error, and I have no means of debugging.

More info: it’s hosted on the app platform static website feature and is built with a dockerfile using astro, here’s the repo if anyone’s interested.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 6, 2023

Hi there,

What I could suggest is to deploy your app as a static site rather than using a Dockerfile. That way the website assets will be compiled during the build stage and then you will not need to run a Docker container with Nginx installed.

What you might have to do is define Node.js 18.x as the version as your app does not seem to work with the default 16.x. You can do that by adding the following to your package.json and then running npm update and push that to your repository:

  "engines": {
    "node": "18.x"
  }

Here is a step by step tutorial on how to deploy a static website on the App Platform:

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-static-website-to-the-cloud-with-digitalocean-app-platform

As a test, I forked your repository and tried to deploy it that way and can confirm that it was successful.

Let me know if you have any questions!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel