Skip to main content

Troubleshooting Common Deployment Issues

If you encounter any difficulties with your Deployments, consider the following ten steps to address and resolve common problems.

If you still need help, even after trying all these steps, please check our Community Hub for additional resources.

Webview issues in Replit.app and Replit.dev

If you are having trouble accessing Replit (Example: replit.app or replit.dev) due to web filters or restrictions, you can try using public DNS resolvers like Google DNS (8.8.8.8) or Cloudflare DNS (1.1.1.1) to bypass these issues.

Change DNS settings

On Windows

  1. Open the Control Panel.
  2. Go to "Network and Sharing Center."
  3. Select "Change adapter settings" on the left.
  4. Right-select on your active network connection and select "Properties."
  5. Select "Internet Protocol Version 4 (TCP/IPv4)" and select "Properties."
  6. Choose "Use the following DNS server addresses."
  7. Enter a public DNS server's IP address (e.g., 8.8.8.8 for Google DNS or 1.1.1.1 for CloudFlare DNS) in both "Preferred DNS server" and "Alternate DNS server" fields.
  8. Select "OK" to save the changes.

If you are using Windows and need more detailed instructions for changing DNS settings, you can refer to this link from Microsoft for comprehensive guidance on DNS configuration specific to Windows.

On MacOS

  1. Go to "System Preferences."
  2. Select "Network."
  3. Select your active network connection on the left.
  4. Select "Advanced" in the lower-right corner.
  5. Go to the "DNS" tab.
  6. Select the "+" button to add a DNS server.
  7. Enter a public DNS server's IP address (e.g., 8.8.8.8 for Google DNS or 1.1.1.1 for CloudFlare DNS).
  8. Select "OK" and then "Apply."

If you are using a Mac and need more detailed instructions for changing DNS settings, you can refer to this Apple support link for comprehensive guidance on DNS configuration specific to macOS.

On Linux

  1. Depending on your Linux distribution, edit the /etc/resolv.conf file to add public DNS servers.
  2. Add lines like these:
nameserver 8.8.8.8
nameserver 1.1.1.1

You can also refer to the Debian Wiki for additional information on how to update name servers for various network managers used in different Linux distributions. The Debian Wiki provides comprehensive guidance on DNS configuration that can be helpful for a wider range of Linux users.

Clear DNS Cache

After changing DNS settings, clear the DNS cache to ensure the new settings are applied. Open a command prompt or terminal and run the following command:

  • On Windows: ipconfig /flushdns
  • On macOS and Linux: sudo systemctl restart NetworkManager (may vary depending on your Linux distribution)
note

As part of our efforts to enhance regional performance and stability, we may occasionally need to change the replit.dev URLs for your projects when moving them between clusters. However, once the migration process is complete, these new URLs are expected to remain stable for approximately one year, unless you explicitly request to change your project's location between North America and Asia. We appreciate your understanding as we work to provide you with an improved experience.

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?

Reserved and Autoscale Deployments only work on Repls that are 8 GB or less in size, and Static Deployments can only be up to 1 GB. Try deleting some files or using an external datastore, such as our integrated PostgreSQL.

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.

Do the Deployment logs contain messages on missing dependencies that exist in your Repl?

Refer to the section on package caching.

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, replace main.py with the name of your file instead.

Package Caching

To improve development times on Node and Python Deployments, the build process excludes development dependencies from the Deployment bundle by default. Replit also caches your project's dependencies so that they can be reused across Deployments. If you run into issues with missing dependencies, you may need to selectively disable these features.

First, try including development dependencies in the Deployment build. You can do that by defining the REPLIT_KEEP_PACKAGE_DEV_DEPENDENCIES environment variable in the .replit file.

[env]
REPLIT_KEEP_PACKAGE_DEV_DEPENDENCIES = "1"

If that doesn't work, you can disable package caching altogether. This can also be done by defining an environment variable in .replit. In this case the variable you need to define is REPLIT_DISABLE_PACKAGE_LAYER.

[env]
REPLIT_DISABLE_PACKAGE_LAYER = "1"

Development dependencies

Package managers allow categorizing certain dependencies as development-only. This can be useful for reducing the bundle size when deploying your application to production. For more information, refer to the Dependency Management documentation.

Was this helpful?