microsoft / azurechat

🤖 💼 Azure Chat Solution Accelerator powered by Azure Open AI Service
MIT License
1.24k stars 1.21k forks source link

new CosmosClient throws ERR_INVALID_URL #44

Closed xuxife closed 1 year ago

xuxife commented 1 year ago

Hi, I'm using my fresh deployed cosmos db URI in a format of "https://<my-cosmos>.documents.azure.com:443/", while the following runtime error is thrown. I check the @azure/cosmos document, turns out the URI format is correct.

Do we have any clue about the cause or have any workaround?

image
- error TypeError [ERR_INVALID_URL]: Invalid URL
    at memoryContainer (./features/common/cosmos.ts:15:20)
    at FindAllChatThreadForCurrentUser (./features/chat/chat-services/chat-thread-service.ts:29:92)
    at ChatMenu (./features/chat/chat-menu/chat-menu.tsx:19:138)
    at stringify (<anonymous>)
- error TypeError [ERR_INVALID_URL]: Invalid URL
    at memoryContainer (./features/common/cosmos.ts:15:20)
    at FindAllChatThreadForCurrentUser (./features/chat/chat-services/chat-thread-service.ts:29:92)
    at Home (./app/chat/page.tsx:18:138)
    at async Promise.all (index 0)
    at async Promise.all (index 0)
- error TypeError [ERR_INVALID_URL]: Invalid URL
    at memoryContainer (./features/common/cosmos.ts:15:20)
    at FindAllChatThreadForCurrentUser (./features/chat/chat-services/chat-thread-service.ts:29:92)
    at ChatMenu (./features/chat/chat-menu/chat-menu.tsx:19:138)
    at stringify (<anonymous>)
- error TypeError [ERR_INVALID_URL]: Invalid URL
    at memoryContainer (./features/common/cosmos.ts:15:20)
    at FindAllChatThreadForCurrentUser (./features/chat/chat-services/chat-thread-service.ts:29:92)
    at ChatMenu (./features/chat/chat-menu/chat-menu.tsx:19:138)
    at stringify (<anonymous>)
digest: "304417822"
- error TypeError [ERR_INVALID_URL]: Invalid URL
    at memoryContainer (./features/common/cosmos.ts:15:20)
    at FindAllChatThreadForCurrentUser (./features/chat/chat-services/chat-thread-service.ts:29:92)
    at Home (./app/chat/page.tsx:18:138)
    at async Promise.all (index 0)
    at async Promise.all (index 0)
- error TypeError [ERR_INVALID_URL]: Invalid URL
    at memoryContainer (./features/common/cosmos.ts:15:20)
    at FindAllChatThreadForCurrentUser (./features/chat/chat-services/chat-thread-service.ts:29:92)
    at ChatMenu (./features/chat/chat-menu/chat-menu.tsx:19:138)
    at stringify (<anonymous>)
dcnsakthi commented 1 year ago

Hi @xuxife, For reference, you can check the src/.env.example file. Make sure that there are no double quotes in the values of your .env file.

image
janegilring commented 1 year ago

I am seeing a similar error which I think is related to Cosmos:

image

The Application setting is defined like this:

image

Do you see any obvious reason for why it is failing?

oliverlabs commented 1 year ago

@janegilring, today's commits broke the deployment by trying to fix the spelling error in this variable. It should be AZURE_COSMOSDB_URI. Revert your branch to the last of Aug 3 commit and redeploy the app. It worked for me.

thivy commented 1 year ago

Thanks @oliverlabs Yes that is correct, there were typo for cosmos related in env.local and fixed.

It used to be COSMOSE and now fixed to COSMOS