The service has encountered an error while checking the health of app

I get the error The service has encountered an error while checking the health of the Streamlit app: Get “http://localhost:8501/healthz”: read tcp> read: connection reset by peer in my app:

How can I solve it?

Your current error indicates that there is a problem with the Google Cloud Run health check of your Streamlit app. The health check is carried out by sending a request to your app’s ‘/healthz’ endpoint, but the issue appears to be caused by the peer seemingly resetting the connection.

The steps listed below can be used to resolve this problem:

Before deploying your Streamlit app to Google Cloud Run, make sure it is functioning properly locally. ‘streamlit run’ can be used to test your app locally. Just substitute the name of your Streamlit app file with ‘’. Make that there are no runtime issues and that all dependencies have been correctly installed.

  1. Examine your Cloud Run settings. Look over the following:
  • Verify that the port for your Streamlit app is the proper one. Streamlit programs run on port 8501 by default. The ‘–port’ flag in the Cloud Run deployment command or specifying the ‘PORT’ environment variable in your Dockerfile must be used to provide the right port when deploying to Cloud Run.

    • Verify that HTTP rather than HTTPS is being used by the Cloud Run service. Because HTTPS is not natively supported by Streamlit programs, you must set the Cloud Run service to utilize HTTP.
  1. Make sure your Dockerfile’s ‘CMD’ or ‘ENTRYPOINT’ runs your Streamlit program as intended. Make that the command you used to launch your app, such as “streamlit run” or “python” (change “” with the name of your Streamlit app file), is the proper one.

  2. Double-check your Dockerfile to make sure the Streamlit app and its dependencies were built and included correctly. Verify that all required files are included and that the Docker image builds successfully and without any issues.

  3. Verify your firewall settings and network configuration. It’s possible that the network problem or firewall setup is the cause of the connection reset. Check your network settings to make sure the required ports are available and open.

Reviewing the Cloud Run logs and error messages for more detailed information regarding the error’s root cause may be beneficial if the problem still exists after performing these procedures.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.