Application error after deploying azure open ai code to azure web app

Amir Basha 40 Reputation points
2024-12-25T03:14:00.54+00:00

Hi,

My azure open ai web app chatbot is working fine before today. So today, I'm doing some minor changes to the code. Compile and run locally and the chatbot works fine.

Then I deploy it to existing web app in Azure successfully. But after a while when opening the website, I get this Application error page.

Try to restart couple of time but still not working. Try redeploy it again same error.

When I check on log stream in the web app, the error stating that "Container hcd-mierabot_0_f36d1fee didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging."

Already added environmental variables for WEBSITES_PORT=8000 also not working.

Is there a solution for this?

Thanks

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

1 answer

Sort by: Most helpful
  1. Sina Salam 14,551 Reputation points
    2024-12-25T07:53:25.6533333+00:00

    Hello Amir Basha,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are having application error after deploying azure open ai code to azure web app.

    To troubleshoot this error, though it seems like a generic error but try and do the followings:

    1. Verify the Dockerfile and Application Port Configuration and confirm your application is explicitly set to listen on 0.0.0.0:8000:
      1. Dockerfile should include the following lines: EXPOSE 8000
      2. For Python (Flask, FastAPI, etc.), for instance: app.run(host="0.0.0.0", port=8000)
    2. Use the Azure CLI or Azure portal to access detailed logs using bash command: az webapp log tail --name <your-app-name> --resource-group <your-resource-group> Investigate any application-specific errors (e.g., missing dependencies, runtime crashes).
    3. View container-specific logs using bash command: az webapp log deployment show --name <your-app-name> --resource-group <your-resource-group> Look for errors like dependency issues or the application failing to bind to the expected port.
    4. Run your Docker image locally to confirm it listens correctly:
         docker run -p 8000:8000 <your-image> 
         curl http://localhost:8000
      
    5. Check that WEBSITES_PORT is set to 8000 in the Configuration tab in the Azure portal and verify no other environment variables override the application's port configuration.
    6. Make sure the App Service Plan has sufficient resources (CPU, memory) and if running on Linux, verify the runtime matches your container's base image (e.g., Debian vs. Alpine).
    7. Check for any Network Security Groups (NSGs) or firewalls blocking traffic to port 8000 and make sure the App Service has outbound internet access for dependencies.
    8. Restart the container explicitly via Azure CLI using bash command: az webapp restart --name <your-app-name> --resource-group <your-resource-group> To monitor resource usage in the App Service to ensure the container has enough memory and CPU to start.

    If logs or debugging indicate the issue isn't resolved:

    • Validate the Azure App Service version and ensure compatibility with your container.
    • Then, consider using Azure Monitor or App Insights for detailed diagnostics.

    The following links are similar answers to your issue:

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    0 comments No comments

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.