Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aioboto3 12.3.0 - ValueError: too many values to unpack (expected 2) #329

Open
chandra-goka opened this issue Feb 20, 2024 · 1 comment
Open

Comments

@chandra-goka
Copy link

chandra-goka commented Feb 20, 2024

  • Async AWS SDK for Python version: aioboto3 12.3.0
  • Python version: 3.8
  • Operating System: Mac

Description

Existing test cases were failing due to ValueError: too many values to unpack (expected 2) after upgrading the aioboto3 version from 12.1.0 to 12.3.0. I upgraded this because there is a known vulnerability in aiobotocore 2.8.0

class TestCheckModel(Model):
    class Meta:
        table_name = os.environ.get(“TEST_TABLE")
        region = constants.REGION
        billing_mode = constants.BILLING_MODE

    document_name = UnicodeAttribute(hash_key=True)

    created_by = UnicodeAttribute()
    created_at = UnicodeAttribute(default=datetime.utcnow().isoformat())

Test case :

@pytest.fixture(scope="session")
def create_checks_table(start_dynamo_local: int):

    if not TestCheckModel.exists():
        TestCheckModel.create_table(wait=True)

What I Did

Updated the aioboto3 version from 12.1.0 to 12.3.0.

pytest -x --cov=src/

Error:

@pytest.fixture(scope="session")
def create_checks_table(start_dynamo_local: int):

>    if not TestCheckModel.exists():
        TestCheckModel.create_table(wait=True)

Stacktrace:

.venv/lib/python3.8/site-packages/pynamodb/models.py:775: in exists
    cls._get_connection().describe_table()
.venv/lib/python3.8/site-packages/pynamodb/connection/table.py:293: in describe_table
    return self.connection.describe_table(self.table_name)
.venv/lib/python3.8/site-packages/pynamodb/connection/base.py:802: in describe_table
    data = self.dispatch(DESCRIBE_TABLE, operation_kwargs)
.venv/lib/python3.8/site-packages/pynamodb/connection/base.py:347: in dispatch
    data = self._make_api_call(operation_name, operation_kwargs, settings)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Connection<http://localhost:10764>, operation_name = 'DescribeTable', operation_kwargs = {'TableName': 'test.platform-services.agent-healthchecks'}
settings = <pynamodb.settings.OperationSettings object at 0x10d1c46d0>

    def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings: OperationSettings = OperationSettings.default) -> Dict:
        """
        This private method is here for two reasons:
        1. It's faster to avoid using botocore's response parsing
        2. It provides a place to monkey patch HTTP requests for unit testing
        """
        operation_model = self.client._service_model.operation_model(operation_name)
        if self._convert_to_request_dict__endpoint_url:
            request_context = {
                'client_region': self.region,
                'client_config': self.client.meta.config,
                'has_streaming_input': operation_model.has_streaming_input,
                'auth_type': operation_model.auth_type,
            }
>           endpoint_url, additional_headers = self.client._resolve_endpoint_ruleset(
                operation_model, operation_kwargs, request_context
            )
E           ValueError: too many values to unpack (expected 2)

.venv/lib/python3.8/site-packages/pynamodb/connection/base.py:383: ValueError
@terricain
Copy link
Owner

site-packages/pynamodb/connection/base.py Pynamodb is not aioboto3, what specific error do you have with aioboto3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants