Getting 504 Gateway Timeout error after successful deployment.

Dipesh Charthad 0 Reputation points
2025-01-07T11:38:33.96+00:00

We are able to deploy the code successfully but are getting a 504 gateway timeout error.

Platform logs are as below:
INFO - Initiating warmup request to container ds-website-chatbot_0_8017aeb3 for site ds-website-chatbot
INFO - Waiting for response to warmup request for container ds-website-chatbot_0_8017aeb3. Elapsed time = 265.022934 sec

Here is the error message in the platform logs.
ERROR - Container ds-website-chatbot_0_44ee8ce9 for site ds-website-chatbot has exited, failing site start

Details about the project:
This is our requirements.txt
fastapi==0.115.6

uvicorn==0.27.0

azure-search-documents==11.5.2

azure-core==1.32.0

openai==1.58.1

msal==1.31.1

websockets==14.1

azure-core==1.32.0

typing_extensions==4.12.2

aiohttp==3.11.11

transformers==4.47.1

bert-score==0.3.13

nltk==3.9.1

torch==2.5.1

numpy==2.2.1

python-dotenv==1.0.1

scikit-learn==1.6.0

pandas==2.2.3

tqdm==4.67.1

rouge_score==0.1.2

scipy==1.14.1

spacy==3.8.3

selfcheckgpt==0.1.7

sentencepiece==0.2.0

https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl

accelerator_detect-0.1.1-py3-none-any.whl

azure-data-tables==12.6.0

sentence-transformers==3.3.1

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,506 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,037 questions
{count} votes

Accepted answer
  1. Vikram Singh 100 Reputation points Microsoft Employee
    2025-01-08T07:51:48.3266667+00:00

    Hello @Dipesh Charthad ,

    Thanks for posting your question in Microsoft Q&A, apologize for any inconvenience caused on this.

    The 504 Gateway Timeout error you're encountering typically indicates that the server did not receive a timely response from an upstream server or service. In your case, the logs show that the warmup request for the container ds-website-chatbot_0_8017aeb3 took over 265 seconds without a response, which is unusually long and suggests that the container may not be starting up correctly. Here are some steps you can take to troubleshoot and resolve this issue:

    1. Check Container Logs: Look at the logs for the specific container (ds-website-chatbot_0_44ee8ce9) that has exited. This may provide more insight into why the container failed to start. You can usually find these logs in your cloud provider's dashboard or through the command line.
    2. Resource Allocation: Ensure that the container has sufficient resources (CPU, memory) allocated to it. If the application is resource-intensive, it may require more resources than currently allocated.
    3. Dependencies: Review your requirements.txt file for any potential issues with the dependencies. Ensure that all required packages are compatible with each other and that there are no version conflicts. You might want to try creating a virtual environment and installing the dependencies there to see if any errors arise.
    4. Application Code: Check your FastAPI application code for any blocking operations or long-running tasks that could delay the startup process. If your application is performing heavy computations or waiting for external services during startup, consider optimizing this code.
    5. Timeout Settings: If applicable, check the timeout settings for your web server (e.g., Uvicorn) and any load balancers or proxies in front of your application. You may need to increase the timeout settings to allow for longer startup times.

    Do let me know if you are still the facing the issue.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.