Start with the live app's logs
Before changing anything, open the logs of the live app (in your builder's publishing screen, or on your server). The first error there usually names the missing piece: an empty key, a refused connection, a file that is not found.
Five things to check
- Your secret keys did not come with you.
Keys you add in the editor are often kept apart from the live app. Replit, for example, says secrets you set in the editor "do not automatically carry over" to the published app, and missing secrets cause "errors about undefined values, failed API calls, database connection failures". Add them again where the live app runs. Full walk-through: My API keys didn't reach the server.
- The app listens on "localhost".
"localhost" means "this computer only". It works in preview and fails once the app is published. A published app must listen on
0.0.0.0, which means "any address". - The live app still uses the test database.
Builders often start you on a test database. Check which database the live app connects to, and that its address and password are set in the live app, not only in preview.
- Files you saved inside the app disappear.
On some platforms the published app's disk is wiped every time you publish. Uploads and data saved as files vanish. Keep them in a database or a storage service.
- Something still points to the preview address.
Login redirect addresses, payment webhooks and lists of allowed websites (CORS) are set per address. Add your live address to each of them.
Common mistakes
- Changing code before reading the logs. The error message usually says what is missing.
- Fixing it in preview again. Preview already works. The fix belongs in the live app's settings.
- Putting a secret key in browser code to "make it work". Anything the browser gets, every visitor can read. See My API keys didn't reach the server.
Limits
- The examples come from Replit's documentation. Other builders name these settings differently; look for "secrets", "environment variables" or "publishing settings".
- This guide does not fix code errors that also happen in preview.
- ANAROQ does not host your app.