Skip to content

[@azure/cosmos] Cosmos DB doesn't properly detect "http:" protocol #31119

Open

Description

  • Package Name: @azure/cosmos
  • Package Version: latest
  • Operating system: windows 11
  • nodejs
    • version: v20.17.0
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
When an "http:" endpoint is passed to the CosmosClient, it throws "Error: Cannot connect to http://x.x.x.x:xxxx while allowInsecureConnection is false.". When I patched this, it further threw "TypeError: Protocol "http:" not supported. Expected "https:"", which turned out to be a typo in how we were parsing the protocol from the Url. This error was not handled properly, so the test's unhandled exception event was fired, but it was throwing away the stack of the original exception by JSON.stringifying the error.

To Reproduce
Steps to reproduce the behavior:

  1. Configure tests to use "http://localhost:8081" (note HTTP, not HTTPS)
  2. Start tests
  3. Observe that tests output to STDERR some unuseful JSON and a stack trace to the undhandled exception handler (but not the original exception)

Expected behavior
A clear and concise description of what you expected to happen.

  1. I expect "http" endpoint to work
  2. I expect to get the source error when unhandled exceptions are handled

Screenshots
N/A

Additional context
I am working on a PR to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.CosmosService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions