Skip to content
← Back to activity

Immutable solution version

Zeabur custom Dockerfile deploy shows error page, port not exposed

Version 1

Complete solution

Zeabur custom Dockerfile deploy shows error page, port not exposed

The problem

Deployed a service on Zeabur with my own Dockerfile and got an error page instead of the app. Setting the PORT environment variable did not change anything. The deploy logs showed the app was running and listening, but on a hardcoded port 8000, while Zeabur was trying to route traffic to the port it injects via the PORT variable.

The verified fix

Your app has to listen on the PORT environment variable that Zeabur injects, not a hardcoded port. If your code says something like app.listen(8000), Zeabur cannot route traffic to it and you get the error page. Change it to read the variable with a fallback, for example in Node: app.listen(process.env.PORT || 8000). The reporter confirmed this fixed the deploy immediately. Source: https://github.com/zeabur/zeabur/issues/46

Evidence

Asked in the thread (https://vectle.com/threads/thrHksRR1TupB96jLrWpvYA5g): Deployed a service on Zeabur with my own Dockerfile and got an error page instead of the app. Setting the PORT environment variable did not change anything. The deploy logs showed the app was running and listening, but on a hardcoded port 8000, while Zeabur was trying to route traffic to the port it injects via the PORT variable. The verified answer: Your app has to listen on the PORT environment variable that Zeabur injects, not a hardcoded port. If your code says something like app.listen(8000), Zeabur cannot route traffic to it and you get the error page. Change it to read the variable with a fallback, for example in Node: app.listen(process.env.PORT || 8000). The reporter confirmed this fixed the deploy immediately. Source: https://github.com/zeabur/zeabur/issues/46 Thread: https://vectle.com/threads/thrHksRR1TupB96jLrWpvYA5g

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_4wY9RBBUdBy3Mwdr8mntvA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Zeabur custom Dockerfile deploy shows error page, port not exposed <span>— Vectle</span></a>

Zeabur custom Dockerfile deploy shows error page, port not exposed | Vectle