Troubleshooting Common Deployment Issues
Here are ten things you can try if you are having any trouble with your deployments.
If you still need assistance after trying all ten things, please post your question in the Replit Help category on our forum and we will help you as soon as possible.
- Does your Repl work within the Replit Workspace? Press the big button at the top of the screen that says “Run”. If it doesn’t show you a webview with a web address ending in the repl.co domain, your code doesn’t work. Once that’s fixed up, you can try deploying again.
- Is your program running continuously? Deployments expect that your program never runs to completion, and will try to restart it if it does. If your program just runs a function and exits, this will not work.
- If you’re running a website (as opposed to a bot), is the server listening on 0.0.0.0? Deployments can automatically detect which port your server is running on, but only if it’s listening on the 0.0.0.0 address. If it’s listening on localhost or 127.0.0.1, it won’t work.
- Are there any errors in your application? Look in the “Logs” tab at the top of the Deployments pane to see the output of your application. Are there any stack traces or exceptions that you can see? This indicates an error in your code due to various issues such as uninitialized variables or trying to use packages that aren’t installed.
- Are your run and build commands correct? Common mistakes here include typos, using incorrect flags, or specifying the wrong file or directory. Double-check your commands and make any necessary adjustments.
- Did you specify all your production secrets and environment variables in the Deployments pane? Putting them in the Secrets pane is not enough – they won’t copy over automatically. This may cause your application to fail in the initialization step with errors about undefined values.
- Is your Repl too big? Repls have a 1 GB storage limit. We are working to increase this, but for now if your build command generates too many additional files, you may run out of storage space. Try deleting some files from your Repl, or offloading storage to a database.
- Does your homepage take a long time to load? Before marking your Deployment as successful, we run a health check where we try to reach it via an HTTP request. If your main page takes more than 5 seconds to load, the health check will time out and the Deployment will fail in the last step.
- Do you have any ports specified in the .replit config? If you have any ports specified, we turn off port auto-detection and rely on the config you have provided. You must specify a port in the config with an externalPort equal to 80 in order for the promotion step to pass. Make sure your server is listening on the specified localPort.
- Are you relying on SQLite or the file system for data storage? The file system available in deployments is not persistent, and gets reset every time you deploy your Repl. For data persistence, we recommend using a database such as our integrated PostgreSQL.
Here's an example of what the logs tab might look like:
Deploying Streamlit Applications
Streamlit applications work seamlessly with Replit Deployments. To deploy a Streamlit application most easily, use this template.
Or, set the run command for deployments to this:
streamlit run --server.address 0.0.0.0 --server.headless true --server.enableCORS=false --server.enableWebsocketCompression=false main.py
If your application is in a different file other than
main.py with the name of your file instead.