microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Container Terminates with 503 Error after ‘az webapp up’ Deployment

ZMaguffin22 opened this issue · comments

When doing an az webapp up on a new repository setup with any model version, chat with your own data (AI Search) and Chat history enabled. the container keeps terminating and causing a 503 error. Run an az web app up like the instructions provide either with a new or existing app service, the app receives an 503 error where expected behavior would be for the app to be reachable.

Runtime and Startup Command.
{
"runtime": "PYTHON|3.11",
"startupCommand": "python3 -m gunicorn app:app"
}

The log stream's traceback ultimately end's with this before terminating the containers.

2024-06-25T19:46:45.4119587Z azure_openai: _AzureOpenAISettings = _AzureOpenAISettings()
2024-06-25T19:46:45.4119626Z ^^^^^^^^^^^^^^^^^^^^^^
2024-06-25T19:46:45.4119683Z File "/tmp/8dc954dd1d2c200/antenv/lib/python3.11/site-packages/pydantic_settings/main.py", line 84, in init
2024-06-25T19:46:45.4119719Z super().init(
2024-06-25T19:46:45.4119760Z File "/tmp/8dc954dd1d2c200/antenv/lib/python3.11/site-packages/pydantic/main.py", line 176, in init
2024-06-25T19:46:45.4119798Z self.pydantic_validator.validate_python(data, self_instance=self)
2024-06-25T19:46:45.4119837Z pydantic_core._pydantic_core.ValidationError: 1 validation error for _AzureOpenAISettings
2024-06-25T19:46:45.4119872Z model
2024-06-25T19:46:45.4119910Z Field required [type=missing, input_value={}, input_type=dict]

HI @ZMaguffin22 , it looks like there is an issue with the environment variable AZURE_OPENAI_MODEL based on the stack trace above. The settings are validated using pydantic-settings, which is where this error is coming from. The value of this variable can't be empty, since it is needed to make a successful request to Azure OpenAI.

The variable's value should be set to the name of your model deployment on your Azure OpenAI resource. Can you double check the value of this variable in your app settings in your deployed app to be sure that it is set to the correct value?

Hi abhan,

Confirming it is assigned to the model deployment for my Azure OpenAI resource, I've tried recreating my OpenAI resource and deployment's but still having the issue. Let me know if there's any other log's that would help.

open a new terminal in local ide and select cmd ,
type set ENVIRONMENT="your env file last name"
try with this.

Hi abhan,

Confirming it is assigned to the model deployment for my Azure OpenAI resource, I've tried recreating my OpenAI resource and deployment's but still having the issue. Let me know if there's any other log's that would help.

Just wanted to check if there were any other error logs before the lines you shared previously. I'm asking in case this exception may have been triggered by a different exception.