Azure-Samples / rag-postgres-openai-python

A RAG app to ask questions about rows in a database table. Deployable on Azure Container Apps with PostgreSQL Flexible Server.
MIT License
106 stars 17 forks source link

Endpoint URL Launch issue #44

Closed lokeshkri closed 3 weeks ago

lokeshkri commented 3 weeks ago

Description

What is wrong or what would you like to see improved? After going through the deployment process, post all steps completing successfully the URL link appears when clicked getting an error message.

upstream connect error or disconnect/reset before headers. retried and the latest reset reason: remote connection failure, transport failure reason: delayed connect error: 111

From devtools: chrome-error://chromewebdata/:1

   Failed to load resource: the server responded with a status of 502 ()

Environment

Describe your OS and dev environment (Codespaces, Dev Container, etc): Codespacess setup

pamelafox commented 3 weeks ago

You're seeing a 502 with the App Service URL or with the Codespaces URL? I saw the 502 with Codespace URLs this morning, and ended up working around that by changing my local port. If you are seeing 502s with App Service, then you'll need to check the App Service logs. My guide from another repo can help with that: https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/docs/appservice.md

Thanks for filing!

lokeshkri commented 3 weeks ago

Error is with Web App Service end point URL. Thanks for the pointers. This is the error message I am noticing in the WebContainer App.

Console Log 2024-06-11T16:36:31.43548 Connecting to the container 'main'... 2024-06-11T16:36:31.45862 Successfully Connected to container: 'main' [Revision: 'xxxxxxxxxx-uhlvle-ca--azd-1718120404-7d46647f96-pccw4', Replica: 'xxxxxxxxxx-uhlvle-ca--azd-1718120404'] 2024-06-11T16:31:29.148172875Z from . import frontend_routes # noqa 2024-06-11T16:31:29.148177443Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-11T16:31:29.148182092Z File "/demo-code/fastapi_app/frontend_routes.py", line 22, in 2024-06-11T16:31:29.148187012Z Mount("/assets", app=StaticFiles(directory=parent_dir / "static/assets"), name="static_assets"), 2024-06-11T16:31:29.148191790Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-06-11T16:31:29.148196529Z File "/usr/local/lib/python3.12/site-packages/starlette/staticfiles.py", line 59, in init 2024-06-11T16:31:29.148201559Z raise RuntimeError(f"Directory '{directory}' does not exist") 2024-06-11T16:31:29.148206458Z RuntimeError: Directory '/demo-code/static/assets' does not exist 2024-06-11T16:31:29.148521917Z [2024-06-11 16:31:29 +0000] [12] [INFO] Worker exiting (pid: 12) 2024-06-11T16:31:31.753497489Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:9) exited with code 3 2024-06-11T16:31:31.840387099Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:15) was sent SIGTERM! 2024-06-11T16:31:31.848160454Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:10) was sent SIGTERM! 2024-06-11T16:31:31.848240283Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:16) was sent SIGTERM! 2024-06-11T16:31:31.849338988Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:11) was sent SIGTERM! 2024-06-11T16:31:31.854956329Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:12) was sent SIGTERM! 2024-06-11T16:31:31.857906620Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:14) was sent SIGTERM! 2024-06-11T16:31:31.940407565Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:17) was sent SIGTERM! 2024-06-11T16:31:31.940649815Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Worker (pid:13) was sent SIGTERM! 2024-06-11T16:31:31.948569778Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Shutting down: Master 2024-06-11T16:31:31.948601357Z [2024-06-11 16:31:31 +0000] [8] [ERROR] Reason: Worker failed to boot.

System Log

{"TimeStamp":"2024-06-11T16:41:47Z","Type":"Normal","ContainerAppName":null,"RevisionName":null,"ReplicaName":null,"Msg":"Connecting to the events collector...","Reason":"StartingGettingEvents","EventSource":"ContainerAppController","Count":1} {"TimeStamp":"2024-06-11T16:41:48Z","Type":"Normal","ContainerAppName":null,"RevisionName":null,"ReplicaName":null,"Msg":"Successfully connected to events server","Reason":"ConnectedToEventsServer","EventSource":"ContainerAppController","Count":1} {"TimeStamp":"2024-06-11 16:25:10 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Persistent Failiure to start container","Reason":"ContainerBackOff","EventSource":"ContainerAppController","Count":59} {"TimeStamp":"2024-06-11 16:25:58 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Container \u0027main\u0027 was terminated with exit code \u00273\u0027","Reason":"Error","EventSource":"ContainerAppController","Count":13} {"TimeStamp":"2024-06-11 16:25:58 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Container \u0027main\u0027 was terminated with exit code \u00273\u0027","Reason":"Error","EventSource":"ContainerAppController","Count":14} {"TimeStamp":"2024-06-11 16:30:18 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Persistent Failiure to start container","Reason":"ContainerBackOff","EventSource":"ContainerAppController","Count":82} {"TimeStamp":"2024-06-11 16:31:34 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Container \u0027main\u0027 was terminated with exit code \u00273\u0027","Reason":"Error","EventSource":"ContainerAppController","Count":15} {"TimeStamp":"2024-06-11 16:31:34 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Container \u0027main\u0027 was terminated with exit code \u00273\u0027","Reason":"Error","EventSource":"ContainerAppController","Count":16} {"TimeStamp":"2024-06-11 16:35:09 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Persistent Failiure to start container","Reason":"ContainerBackOff","EventSource":"ContainerAppController","Count":104} {"TimeStamp":"2024-06-11 16:37:14 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Container \u0027main\u0027 was terminated with exit code \u00273\u0027","Reason":"Error","EventSource":"ContainerAppController","Count":17} {"TimeStamp":"2024-06-11 16:37:14 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Container \u0027main\u0027 was terminated with exit code \u00273\u0027","Reason":"Error","EventSource":"ContainerAppController","Count":18} {"TimeStamp":"2024-06-11 16:40:16 \u002B0000 UTC","Type":"Warning","ContainerAppName":"xxxxxxxxxx","RevisionName":"xxxxxxxxxx","ReplicaName":"xxxxxxxxxx-1718120404-7d46647f96-pccw4","Msg":"Persistent Failiure to start container","Rea son":"ContainerBackOff","EventSource":"ContainerAppController","Count":127}

pamelafox commented 3 weeks ago

Hm, that static folder should have been built in the prepackage step, from this line: https://github.com/Azure-Samples/rag-postgres-openai-python/blob/main/azure.yaml#L15C27-L15C64

Can you try running that step manually to see if it's perhaps error'ing?

cd frontend;npm install;npm run build

lokeshkri commented 3 weeks ago

Running the steps manually /redeployment potentially must have helped, seems the app is back up and running now. Many thanks!

pamelafox commented 3 weeks ago

Okay, App Service deployment can be a bit finicky, I'll keep my eye out for the issue. Closing this for now, glad it's working.