azure-search-openai-demo
azure-search-openai-demo copied to clipboard
AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true
Please provide us with the following information:
This issue is for a: (mark with an x)
- [x ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
I want to enable the chat record function of cosmos db. I have set the environment variables in the terminal. However, after the app is deployed, the message AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true will still appear, causing the app to fail to start normally.
Any log messages given by the failure
Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1700, in startup await self.ensure_async(func)() File "/app/chat_history/cosmosdb.py", line 173, in setup_clients raise ValueError("AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true") ValueError: AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true 2024-11-29 07:03:45,086 - ERROR - AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true 2024-11-29 07:03:45,087 - ERROR - Application startup failed. Exiting. 2024-11-29 07:03:45,087 - INFO - Worker exiting (pid: 9) 2024-11-29 07:03:45,401 - ERROR - Worker (pid:18) exited with code 3 2024-11-29 07:03:45,498 - ERROR - Worker (pid:9) was sent SIGTERM! 2024-11-29 07:03:45,510 - ERROR - Worker (pid:12) was sent SIGTERM! 2024-11-29 07:03:45,591 - ERROR - Worker (pid:8) was sent SIGTERM! 2024-11-29 07:03:45,599 - ERROR - Worker (pid:11) was sent SIGTERM! 2024-11-29 07:03:45,599 - ERROR - Worker (pid:15) was sent SIGTERM! 2024-11-29 07:03:45,602 - ERROR - Worker (pid:7) was sent SIGTERM! 2024-11-29 07:03:45,604 - ERROR - Worker (pid:13) was sent SIGTERM! 2024-11-29 07:03:45,605 - ERROR - Worker (pid:16) was sent SIGTERM! 2024-11-29 07:03:45,705 - ERROR - Shutting down: Master 2024-11-29 07:03:45,705 - ERROR - Reason: Worker failed to boot.
Expected/desired behavior
Able to use the chat history function normally
OS and Version?
Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
azd version?
run
azd versionand copy paste here.
Versions
azd version 1.11.0 (commit 5b92e0687e1fa96dfc8292f4b900c0c58610b6a5)
Mention any other details that might be useful
Thanks! We'll be in touch soon.
Hm, AZURE_COSMOSDB_ACCOUNT should have been set once you ran azd up. Did you definitely run azd up after enabling chat history?
Hm, should have been set once you ran . Did you definitely run after enabling chat history?
AZURE_COSMOSDB_ACCOUNT``azd up``azd up
The settings have been completed, but I encountered another problem later. Deployment cannot be done in the eastern United States because the usage in this region is too high. How can I solve this problem? @pamelafox
I can confirm that. Fresh new deployment. (With some existing resources). ContainerApp won't spin up and on the console Log i found: raise ValueError("AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true") ValueError: AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true 2024-12-17 21:15:56,877 - ERROR - AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true 2024-12-17 21:15:56,877 - ERROR - Application startup failed. Exiting. 2024-12-17 21:15:56,878 - INFO - Worker exiting (pid: 12) 2024-12-17 21:15:58,476 - ERROR - Worker (pid:8) exited with code 3 2024-12-17 21:15:58,581 - ERROR - Worker (pid:11) was sent SIGTERM! 2024-12-17 21:15:58,673 - ERROR - Worker (pid:15) was sent SIGTERM! 2024-12-17 21:15:58,673 - ERROR - Worker (pid:16) was sent SIGTERM! 2024-12-17 21:15:58,673 - ERROR - Worker (pid:14) was sent SIGTERM! 2024-12-17 21:15:58,675 - ERROR - Worker (pid:12) was sent SIGTERM! 2024-12-17 21:15:58,676 - ERROR - Worker (pid:13) was sent SIGTERM! 2024-12-17 21:15:58,677 - ERROR - Worker (pid:9) was sent SIGTERM! 2024-12-17 21:15:58,685 - ERROR - Worker (pid:10) was sent SIGTERM! 2024-12-17 21:15:58,778 - ERROR - Shutting down: Master 2024-12-17 21:15:58,778 - ERROR - Reason: Worker failed to boot.
Within the ENV file an empty variable was created:
AZURE_COSMOSDB_ACCOUNT=""
I can confirm that. Fresh new deployment. (With some existing resources). ContainerApp won't spin up and on the console Log i found: raise ValueError("AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true") ValueError: AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true 2024-12-17 21:15:56,877 - ERROR - AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true 2024-12-17 21:15:56,877 - ERROR - Application startup failed. Exiting. 2024-12-17 21:15:56,878 - INFO - Worker exiting (pid: 12) 2024-12-17 21:15:58,476 - ERROR - Worker (pid:8) exited with code 3 2024-12-17 21:15:58,581 - ERROR - Worker (pid:11) was sent SIGTERM! 2024-12-17 21:15:58,673 - ERROR - Worker (pid:15) was sent SIGTERM! 2024-12-17 21:15:58,673 - ERROR - Worker (pid:16) was sent SIGTERM! 2024-12-17 21:15:58,673 - ERROR - Worker (pid:14) was sent SIGTERM! 2024-12-17 21:15:58,675 - ERROR - Worker (pid:12) was sent SIGTERM! 2024-12-17 21:15:58,676 - ERROR - Worker (pid:13) was sent SIGTERM! 2024-12-17 21:15:58,677 - ERROR - Worker (pid:9) was sent SIGTERM! 2024-12-17 21:15:58,685 - ERROR - Worker (pid:10) was sent SIGTERM! 2024-12-17 21:15:58,778 - ERROR - Shutting down: Master 2024-12-17 21:15:58,778 - ERROR - Reason: Worker failed to boot.
Within the ENV file an empty variable was created:
AZURE_COSMOSDB_ACCOUNT=""
Sorry my Bad. I just understood that Authentication must be enabled and deployed to get CosmosDB working. Trying to do that now
Hi - I am running into the same issue. I set
azd env set USE_CHAT_HISTORY_COSMOS true
and then
azd up
The deployment went fine but now I get this error message in App Insights and nothing loads.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1768, in startup
await self.ensure_async(func)()
File "/app/chat_history/cosmosdb.py", line 219, in setup_clients
raise ValueError("AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true")
ValueError: AZURE_COSMOSDB_ACCOUNT must be set when USE_CHAT_HISTORY_COSMOS is true
I re-read the docs and went through the code and I saw that authentication has to be enabled for Cosmos DB chat history to work. Leaving this here for others who make the same mistake.
Thanks for posting, I could make a clearer error in the Python code that the likely issue is the lack of user authentication setup.