Guide · Replit
Replit deployment not working: the published app breaks (works in preview)
Updated
When a Replit app works in the workspace but not after you publish, Replit says this is almost always a configuration difference between the environments, such as Secrets set in the editor that do not carry over to the published app. Other documented causes are a server listening on localhost, wrong run or build commands, a static deployment for a full-stack app, and a slow homepage.
Why it happens
The workspace preview and the published app run separately, with their own settings. Anything the preview gets for free, such as your Secrets, has to be given to the published app too.
The causes, and how to fix each
1. Secrets were set in the editor but not for the published app
Replit says Secrets you set in the Project Editor do not automatically carry over to your published app. Missing Secrets can cause undefined-value errors, failed API calls, database connection failures, login errors or payment failures.
How to fix it
- Open the Publishing pane and add every production Secret and environment variable there.
- Point values such as the database address at production, not at development.
- Publish again so the new values are used.
Source: Replit: Troubleshooting published apps · Replit: Deployment and publishing FAQ
2. The server listens only on localhost
Replit says the server must listen on 0.0.0.0; listening only on localhost or 127.0.0.1 does not work for published apps.
How to fix it
- Change the server to listen on 0.0.0.0.
- Remove addresses hard-coded to localhost from the app.
Source: Replit: Troubleshooting published apps · Replit: Deployment and publishing FAQ
3. The ports in .replit stop the published app from passing
If your .replit file names ports, automatic port detection is turned off.
How to fix it
- In .replit, set externalPort to 80 for the port your app serves.
- Make sure the server listens on the localPort you named.
Source: Replit: Troubleshooting published apps
4. The run or build command is wrong
Replit lists typos, wrong flags, wrong entry files and commands that only work locally as common mistakes.
How to fix it
- Review the build and start commands in the Publishing pane.
- Open the Logs tab in the Publishing pane and look for stack traces, missing packages, failed commands, missing environment variables or startup errors.
Source: Replit: Troubleshooting published apps
5. A full-stack app was published as a static deployment
Replit says static deployments have no backend server, so an app with server-side logic or API routes should use Autoscale instead.
How to fix it
- Change the deployment type to Autoscale in the Publishing pane.
- Publish again.
Source: Replit: Troubleshooting published apps · Replit: Deployment types (Static)
6. The homepage takes more than five seconds to answer
Replit requests your homepage before the app goes live. If it takes more than five seconds, the health check can time out and publishing can fail at the final step.
How to fix it
- Reduce the work done at startup, move slow work behind a user action, or cache data where it makes sense.
- Publish again.
Source: Replit: Troubleshooting published apps · Replit: Deployment and publishing FAQ
Why you can't see it yourself
You're signed in, your customers aren't. The workspace preview uses your Secrets and a friendly setup. The public address starts from what you gave the published app, and only visitors to it meet what is missing.
Frequently asked questions
Why does my Replit app work in the editor but not when published?
The two environments have separate settings. Replit says Secrets set in the editor do not carry over; add them in the Publishing pane, point the database at production and remove localhost addresses.
I updated a Secret but the published app does not see it. Why?
Changing one environment does not change the other. Set the value for the published app in the Publishing pane, then publish again.
Why did publishing fail at the last step?
Replit checks your homepage before going live. If it takes more than five seconds to respond, the health check can time out.
Where are the logs for my published Replit app?
In the Logs tab of the Publishing pane.
Which deployment type should a web app with a server use?
Not Static, which serves only HTML, CSS and JavaScript. Replit's troubleshooting says to change the type to Autoscale in the Publishing pane.
Can VibeFix fix it for me?
Yes, if you ask. The free check confirms the problem first. Our AI agent can find the cause, fix it in your code and re-check your live app: $79 for one bug, paid up front. If we can't complete your re-check, you get your money back.
Sources (official documentation)
- Replit: Troubleshooting published apps
- Replit: Deployment and publishing FAQ
- Replit: Deployment types (Static)
Related guides
- It works in the preview but breaks after I deploy
- My app shows a blank white page after publishing
- My app is stuck on a loading spinner after I publish it
- "Page not found" when I refresh a page or open a shared link
- Sign-up or login broken after publishing: users bounce back to login or land on localhost
- Stripe checkout not working on my live site (works in test mode)
- v0: environment variables missing on the published app
VibeFix is independent. Replit are trademarks of their owners.
Fixed it? Prove a real stranger gets in
A fix that works from your own account proves nothing about a new customer. Your AI reads your code. VibeFix signs up like a stranger.
Free check. Paste your live app's link: an AI agent signs up to your live app once as a brand-new person ("VibeFix Test") with a real inbox of its own, on a phone and on a computer, and shows how many problems a new user still hits, what each one is, and one screenshot. No account needed. It never changes your app and never emails your users.
Want it fixed?
Our AI agent finds the cause, fixes it in your code and re-checks your live app. $79 for one bug, paid up front. If we can't complete your re-check, you get your money back.
It starts with a free check that confirms the problem on your live app, no account needed.