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.43k stars 2.14k forks source link

Internal server error when loading homepage #888

Open Bouke opened 1 month ago

Bouke commented 1 month ago

Describe the bug I've updated to cee4fc173e4033a0508ddbacf54c117d22ba4855, and now my webapp is failing.

To Reproduce Steps to reproduce the behavior:

  1. Update the webapp using the "Sync" feature in Azure App Service
  2. Go to webapp homepage

Expected behavior Homepage loads.

Actual result Internal server error, the logs show this output:

2024-05-29T20:59:18.2929817Z [2024-05-29 20:59:18 +0000] [76] [ERROR] Error handling request /
2024-05-29T20:59:18.2945022Z Traceback (most recent call last):
2024-05-29T20:59:18.2945355Z   File "/tmp/8dc801fe7a6e0af/antenv/lib/python3.10/site-packages/gunicorn/workers/sync.py", line 136, in handle
2024-05-29T20:59:18.2945513Z     self.handle_request(listener, req, client, addr)
2024-05-29T20:59:18.2945621Z   File "/tmp/8dc801fe7a6e0af/antenv/lib/python3.10/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
2024-05-29T20:59:18.2945748Z     respiter = self.wsgi(environ, resp.start_response)
2024-05-29T20:59:18.2945856Z TypeError: Quart.__call__() missing 1 required positional argument: 'send'
2024-05-29T20:59:18.3764457Z 169.254.129.6 - - [29/May/2024:20:59:18 +0000] "GET / HTTP/1.1" 500 0 "-" "-"

Configuration: Please provide the following N/A.

Additional context N/A.

TomaszDys commented 1 month ago

Guys, you provide this button in the Azure AI studio image that references main branch. Do you even test your main branch? It's not working for a while now...

abhahn commented 1 month ago

Hi @Bouke , I'm not able to repro this by syncing one of my existing apps to the latest as you've described.

One cause I have seen for the error you've shared is not having the app startup command set. Can you try running the following az command to see if it solves the issue?

az webapp config set --startup-file "python3 -m gunicorn app:app" --name <your app name> --resource-group <your resource group>
abhahn commented 1 month ago

@TomaszDys , up until recently, no, there were no tests. We're currently making incremental progress in this area and have test coverage increase in our backlog, but in the meantime if you have any suggested changes you are welcome to make contributions to improve it.

Bouke commented 1 month ago

Hi @abhahn, thank you for getting back to me. I tried the command, noticed a new build from the logs, but it didn't work for me. However I've synced again (now to cb65219979c87672362c4fac4114011f2898ddc6) and the website is working again.

TomaszDys commented 1 month ago

@abhahn My suggestion would be to add at least on e2e test to the release cycle, to make the main branch working all the time. That branch is referenced under button I posted in official MS product. If this branch is not stable, how about linking some stable version tag to the button in Azure AI studio? Will surely help to everyone new to Azure AI studio, and make this highly promoted MS product look more professional.

tkubica12 commented 3 weeks ago

Hi @Bouke , I'm not able to repro this by syncing one of my existing apps to the latest as you've described.

One cause I have seen for the error you've shared is not having the app startup command set. Can you try running the following az command to see if it solves the issue?

az webapp config set --startup-file "python3 -m gunicorn app:app" --name <your app name> --resource-group <your resource group>

This helped, thanks. Nevertheless it makes my automation deployment to not work, what needs to be changed to make this permanent in app settings of WebApp?

Schof-Arco commented 1 week ago

I still have the issue even with the work arounds, we build and deploy the app from our own build servers. Is there anything else i can try? I have posted my logs to see if anyone can see anything obvious

2024-06-19T14:42:52.2972587Z Starting OpenBSD Secure Shell server: sshd. 2024-06-19T14:42:52.3769636Z Site's appCommandLine: python3 -m gunicorn app:app 2024-06-19T14:42:52.5052035Z Starting periodic command scheduler: cron. 2024-06-19T14:42:52.5069069Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand 'python3 -m gunicorn app:app' 2024-06-19T14:42:52.5392953Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it... 2024-06-19T14:42:52.5442753Z Build Operation ID: e3fa33ae632eaaa4 2024-06-19T14:42:52.5445021Z Output is compressed. Extracting it... 2024-06-19T14:42:52.5455900Z Extracting '/home/site/wwwroot/output.tar.gz' to directory '/tmp/8dc906c1c81c061'... 2024-06-19T14:42:52.5490367Z Oryx Version: 0.2.20240501.1, Commit: f83f88d3cfb8bb6d3e2765e1dcd218eb0814a095, ReleaseTagName: 20240501.1 2024-06-19T14:42:57.1493451Z App path is set to '/tmp/8dc906c1c81c061' 2024-06-19T14:42:57.2420133Z Writing output script to '/opt/startup/startup.sh' 2024-06-19T14:42:57.7338748Z Using packages from virtual environment antenv located at /tmp/8dc906c1c81c061/antenv. 2024-06-19T14:42:57.7339758Z Updated PYTHONPATH to '/opt/startup/app_logs:/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages' 2024-06-19T14:42:58.8634384Z [2024-06-19 14:42:58 +0000] [74] [INFO] Starting gunicorn 20.1.0 2024-06-19T14:42:58.8646852Z [2024-06-19 14:42:58 +0000] [74] [INFO] Listening at: http://0.0.0.0:8000 (74) 2024-06-19T14:42:58.8647159Z [2024-06-19 14:42:58 +0000] [74] [INFO] Using worker: sync 2024-06-19T14:42:58.8788707Z [2024-06-19 14:42:58 +0000] [75] [INFO] Booting worker with pid: 75 2024-06-19T14:43:06.3218411Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3219893Z Traceback (most recent call last): 2024-06-19T14:43:06.3220063Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3220136Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3220205Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3220268Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3220351Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3220418Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:06.3234903Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3235720Z Traceback (most recent call last): 2024-06-19T14:43:06.3235877Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3235988Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3236104Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3236169Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3236231Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3236296Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:06.3306124Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3306831Z Traceback (most recent call last): 2024-06-19T14:43:06.3306963Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3307019Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3307106Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3307157Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3307204Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3307253Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:06.3318041Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3318423Z Traceback (most recent call last): 2024-06-19T14:43:06.3318534Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3318585Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3318636Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3318682Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3318744Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3318797Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:06.3388883Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3389655Z Traceback (most recent call last): 2024-06-19T14:43:06.3389781Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3389884Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3389935Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3389982Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3390065Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3390131Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:06.3401986Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3402372Z Traceback (most recent call last): 2024-06-19T14:43:06.3402431Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3402692Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3402786Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3402863Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3402909Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3402955Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:06.3412750Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3413708Z Traceback (most recent call last): 2024-06-19T14:43:06.3413840Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3413892Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3413944Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3414020Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3414066Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3414113Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:06.3474535Z [2024-06-19 14:43:06 +0000] [75] [ERROR] Error handling request /robots933456.txt 2024-06-19T14:43:06.3475765Z Traceback (most recent call last): 2024-06-19T14:43:06.3475901Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:06.3475953Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:06.3476004Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:06.3476050Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:06.3476113Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:06.3476162Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:15.1504231Z [2024-06-19 14:43:15 +0000] [75] [ERROR] Error handling request / 2024-06-19T14:43:15.1505029Z Traceback (most recent call last): 2024-06-19T14:43:15.1505082Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:15.1505121Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:15.1505165Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:15.1505202Z respiter = self.wsgi(environ, resp.start_response) 2024-06-19T14:43:15.1505240Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-19T14:43:15.1505279Z TypeError: Quart.call() missing 1 required positional argument: 'send' 2024-06-19T14:43:15.3189843Z [2024-06-19 14:43:15 +0000] [75] [ERROR] Error handling request /favicon.ico 2024-06-19T14:43:15.3190778Z Traceback (most recent call last): 2024-06-19T14:43:15.3190845Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle 2024-06-19T14:43:15.3190899Z self.handle_request(listener, req, client, addr) 2024-06-19T14:43:15.3190958Z File "/tmp/8dc906c1c81c061/antenv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request 2024-06-19T14:43:15.3191009Z respiter = self.wsgi(environ, resp.start_response)

Schof-Arco commented 6 days ago

Adding the following startup cmd in an azure linux webapp worked for me

python3 -m gunicorn -k uvicorn.workers.UvicornWorker app:app