Hello,
I have integrated the Cosmos SDK into a Go-based command-line application. The application works as expected when querying from my local machine, but queries fail when running on external virtual machines. On those machines, I encounter timeout errors.
I have run several tests to isolate the problem, but I still don’t understand why these timeouts occur. In the database settings, I am currently using a public endpoint with no firewall restrictions.
Here are my tests:
- Testing DNS resolution for Cosmos DB endpoint... ✓ DNS resolution successful
- Testing network connectivity to Cosmos DB... ✓ Network connectivity OK
- Checking Azure CLI installation and authentication... ✓ Azure CLI installed ✓ Logged in to Azure CLI
- Checking authentication environment variables... ℹ No service principal environment variables found Will attempt to use Azure CLI or Managed Identity
- Testing Cosmos DB client creation...
Debug: Creating Cosmos DB client...
Debug: Endpoint: <endpoint>
Debug: Database: <db>
Debug: Testing TCP connectivity to <endpoint>
Debug: TCP connection successful
Debug: Attempting Azure Default Credential authentication...
Debug: Azure credential created successfully
Debug: Creating Cosmos client...
Debug: Azure credential created successfully
Debug: Creating Cosmos client...
Debug: Cosmos client created successfully
✓ Cosmos DB client created successfully
- Testing Cosmos DB query (with 30s timeout)... FAILED: Cannot query Cosmos DB Error: failed to query latest entity major version: failed to query documents: failed to retrieve account properties: context deadline exceeded
Even when I increase the timeout value, the issue persists. I also tried building the source code directly on the virtual machine where I want to run it, but that didn’t help either. (Also I use the same azure user to test the application)
I have correctly set the partition key, and I’m using the same query function as shown in the sdk readme.
Thanks,
Csanad