Skip to content

Azure cosmos 4.15.0 user_agent_overwrite causes connection problem #45387

@aimtsou

Description

@aimtsou
  • Package Name: azure-cosmos
  • Package Version: 4.15.0
  • Operating System: Databricks 14.3.x
  • Python Version: 3.10

Describe the bug
With the new version of azure-cosmos we get the following message

TypeError: Session.request() got an unexpected keyword argument 'user_agent_overwrite'
when we try to initiate a connection to azure cosmos db

To Reproduce
Steps to reproduce the behavior:

  1. Try to connect to azure cosmos db

Expected behavior
The bug does not appear in version 4.14.6

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
In the file here which creates the connection:
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py#L248

        policies = [
            HeadersPolicy(**kwargs),
            ProxyPolicy(proxies=proxies),
            UserAgentPolicy(base_user_agent=self._user_agent, **kwargs),
            CosmosUserAgentPolicy(base_user_agent=self._user_agent, **kwargs),
            ContentDecodePolicy(),
            retry_policy,
            credentials_policy,
                **kwargs
            ),
        ]
        # after passing in the user_agent into the user agent policy the user_agent is no longer needed
        kwargs.pop("user_agent", None)

I believe without being sure that the problem is here we should have also a kwargs.pop("user_agent_overwrite", None)

The file _user_agent_policy.py also uses user_agent_overwrite but it gedts poped in the parent class:
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py#L252

Metadata

Metadata

Assignees

Labels

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

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions