microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.
MIT License
1.59k stars 2.48k forks source link

Startup error after deployment from AOAI Studio: ModuleNotFoundError: No module named 'app' #1117

Open rajbos opened 4 days ago

rajbos commented 4 days ago

Same as #786 : ModuleNotFoundError: No module named 'app' on startup of the App

Describe the bug App won't start after default deployment. I ran the deployment from the Azure OpenAI studio:

image

This lets you create a WebApp and it deploys it with a link back to this repo.

To Reproduce Steps to reproduce the behavior:

  1. Deploy
  2. Wait the time for the deployment to get up and running (as indicated in the studio)
  3. Go to the deployed App Service
  4. Connect to the front end
  5. Get the application error ':( Application Error If you are the application administrator, you can access the diagnostic resources.'
  6. Check the log stream
  7. Notice ModuleNotFoundError: No module named 'app' in the app deployemnt

Expected behavior Working example application :-).

Screenshots If applicable, add screenshots to help explain your problem.

Configuration: Please provide the following

az webapp show --name <app name> --resource-group <resource group name> --query "{startupCommand: siteConfig.appCommandLine, runtime: siteConfig.linuxFxVersion}"

Output:

{
  "runtime": "PYTHON|3.11",
  "startupCommand": "python3 -m gunicorn app:app"
}

Logs

  1. If the application deployment is failing, please share the deployment logs using the following az CLI command:

    az webapp log deployment show --name <app name> --resource-group <rg name>
  2. If the application is crashing after deployment, please share the application logs using the following az CLI command:

    az webapp log tail --name <app name> --resource-group <resource group name>

Output:

Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()--- End of stack trace from previous location ---at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)at Kudu.Services.Web.Tracing.TraceMiddleware.Invoke(HttpContext context) in /tmp/KuduLite/Kudu.Services.Web/Tracing/TraceMiddleware.cs:line 97
2024-09-25T20:25:05      Outgoing response, type: response, statusCode: 500, statusText: InternalServerError/home/LogFiles/2024_09_25_lw1sdlwk000042_default_docker.log  (https://xms-test-app.scm.azurewebsites.net/api/vfs/LogFiles/2024_09_25_lw1sdlwk000042_default_docker.log)
2024-09-25T21:01:49.713040952Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-25T21:01:49.713043952Z   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
2024-09-25T21:01:49.713047552Z   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
2024-09-25T21:01:49.713050652Z   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
2024-09-25T21:01:49.713451248Z ModuleNotFoundError: No module named 'app'
2024-09-25T21:01:49.714568539Z [2024-09-25 21:01:49 +0000] [69] [INFO] Worker exiting (pid: 69)
2024-09-25T21:01:50.067040476Z [2024-09-25 21:01:50 +0000] [63] [ERROR] Worker (pid:69) exited with code 3
2024-09-25T21:01:50.091129767Z [2024-09-25 21:01:50 +0000] [63] [ERROR] Shutting down: Master
2024-09-25T21:01:50.091149867Z [2024-09-25 21:01:50 +0000] [63] [ERROR] Reason: Worker failed to boot./home/LogFiles/2024_09_25_lw1sdlwk000042_docker.log  (https://xms-test-app.scm.azurewebsites.net/api/vfs/LogFiles/2024_09_25_lw1sdlwk000042_docker.log)
2024-09-25T21:01:45.092Z INFO  - docker run -d --expose=8181 --name xms-test-app_0_00fcf0a0_middleware -e WEBSITE_SITE_NAME=xms-test-app -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=xms-test-app.azurewebsites.net -e WEBSITE_INSTANCE_ID=9e1f6eb78aa306362994025a9019b01d24ea90e4aa6191a0617cc39ab9f04ceb mcr.microsoft.com/appsvc/middleware:stage5 REDACTED
2024-09-25T21:01:45.099Z INFO  - Logging is not enabled for this container.Please use https://aka.ms/linux-diagnostics t2024-09-25T21:01:48.682Z INFO  - Initiating warmup request to container xms-test-app_0_00fcf0a0_msiProxy for site xms-test-app
2024-09-25T21:01:48.829Z INFO  - Container xms-test-app_0_00fcf0a0_msiProxy for site xms-test-app initialized successfully and is ready to serve requests.
2024-09-25T21:01:48.837Z INFO  - Initiating warmup request to container xms-test-app_0_00fcf0a0 for site xms-test-app
2024-09-25T21:01:51.227Z ERROR - Container xms-test-app_0_00fcf0a0 for site xms-test-app has exited, failing site start
2024-09-25T21:01:51.228Z INFO  - Initiating warmup request to container xms-test-app_0_00fcf0a0_middleware for site xms-test-app
2024-09-25T21:01:56.203Z INFO  - Container xms-test-app_0_00fcf0a0_middleware for site xms-test-app initialized successfully and is ready to serve requests.
2024-09-25T21:01:56.229Z ERROR - Container xms-test-app_0_00fcf0a0 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
mekjr1 commented 1 day ago

Any updates on this? Facing the same issue

mekjr1 commented 21 hours ago

@iseabock