Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rajbos opened this issue Sep 25, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@rajbos
Copy link

rajbos commented Sep 25, 2024

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

  • Azure OpenAI model name and version (e.g. 'gpt-35-turbo-16k, version 0613'): gpt-4o 2024-05-13
  • Is chat history enabled?: No
  • Are you using data? If so, what data source? (e.g. Azure AI Search, Azure CosmosDB Mongo vCore, etc): I have added Azure AI Search to the Chat playground before I deployed.
  • Verify the startup command and runtime configuration by showing the output of the following az CLI command:
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>
  1. 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.
@rajbos rajbos added the bug Something isn't working label Sep 25, 2024
@mekjr1
Copy link

mekjr1 commented Sep 29, 2024

Any updates on this? Facing the same issue

@mekjr1
Copy link

mekjr1 commented Sep 29, 2024

@iseabock

@sarah-widder
Copy link
Contributor

@rajbos @mekjr1 has the app completed the sync of code from the repo? You can check this from the app service resource Deployment Center page, you need to have an 'active' commit in the Logs tab. If you don't see one you can retry pulling the code by clicking 'sync'. Once there is an active commit, restart the app and it should start up without hitting this error.

@luisdanielse
Copy link

Hi @sarah-widder I am having the same issue.

@kocsispeter
Copy link

Hi @sarah-widder
I have the same issue also.
Tried the complete purge and deploy again, but exactly same error.
Even tried with different model.

@sarah-widder
Copy link
Contributor

@rajbos @mekjr1 has the app completed the sync of code from the repo? You can check this from the app service resource Deployment Center page, you need to have an 'active' commit in the Logs tab. If you don't see one you can retry pulling the code by clicking 'sync'. Once there is an active commit, restart the app and it should start up without hitting this error.

@luisdanielse @kocsispeter does this fix work for you?
You want the deployment center to look like this, and then click Sync so that you see a commit show up active in the Logs.
image

@kocsispeter
Copy link

Checked the Deployment Center / Logs. At first try (earlier) there was commit telling the build failed.

I have pushed the Sync button now, and after a while I saw your commit and the app build was success.

Thank You for the quick fix @sarah-widder!
Problem solved!

@mekjr1
Copy link

mekjr1 commented Oct 4, 2024

@sarah-widder sync fixed the issue for me... It took three sync attempts on my case.

now the on blocker is related to updating existing app.... thanks for your help :)

@rajbos
Copy link
Author

rajbos commented Oct 4, 2024

Same here, glad that it works.

I had to redeploy three times as well. Not a great UX, but glad that it worked @sarah-widder!
Can this be added somewhere in the docs / Azure Portal (where I deployed this from) or generally be improved? This is rather unintuitive behavior when deploying Azure resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants