Skip to content

Unauthorized error in CosmosDB operations #831

Closed
@spica314

Description

@spica314

CosmosDB operations using azure_data_cosmos throw 401 Unauthorized.

For example, an execution of code of examples/readme.rs results below.

Inserting 10 documents...
Error: Error { context: Full(Custom { kind: HttpResponse { status: 401, error_code: None }, error: HttpError { status: 401, error_code: None, headers: {"transfer-encoding": "chunked", "server": "Microsoft-HTTPAPI/2.0", "x-ms-activity-id": "746a4599-4fe5-4956-962e-cd79b7de043f", "x-ms-gatewayversion": "version=2.14.0", "content-type": "application/json", "strict-transport-security": "max-age=31536000", "date": "Sat, 18 Jun 2022 08:34:53 GMT"}, body: b"{\"code\":\"Unauthorized\",\"message\":\"The input authorization token can't serve the request. The wrong key is being used or the expected payload is not built as per the protocol. For more info: https://aka.ms/cosmosdb-tsg-unauthorized. Server used the following payload to sign: 'post\\ndocs\\ndbs/TestDatabase/colls/TestContainer\\nsat, 18 jun 2022 08:34:53 gmt\\n\\n'\\r\\nActivityId: 746a4599-4fe5-4956-962e-cd79b7de043f, Microsoft.Azure.Documents.Common/2.14.0\"}" } }, "server returned error status which will not be retried") }

I confirmed

  • It failed at (least) 55dc046
    • (with dev-dependencies tokio = { version = "1", features = ["macros", "rt-multi-thread"] })
  • It succeed at 267d8ce

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions