Skip to content

Random GSI missing error "ValueError: Table <tablename> has no index: <index_name>" #1291

@armujahid

Description

@armujahid

We randomly notice this error in AWS Lambda logs (and occasionally in local testing) where PynamoDB complains about a missing index that is not missing. Note that the index is a GSI. The stacktrace is attached.

    |   File "/opt/python/our_repo/models/resources/base.py", line 443, in list
    |     pynamodb_results = list(
    |                        ^^^^^
    |   File "/opt/python/pynamodb/pagination.py", line 189, in __next__
    |     self._get_next_page()
    |   File "/opt/python/pynamodb/pagination.py", line 175, in _get_next_page
    |     page = next(self.page_iter)
    |            ^^^^^^^^^^^^^^^^^^^^
    |   File "/opt/python/pynamodb/pagination.py", line 110, in __next__
    |     page = self._operation(*self._args, **self._kwargs)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/opt/python/pynamodb/connection/table.py", line 256, in query
    |     return self.connection.query(
    |            ^^^^^^^^^^^^^^^^^^^^^^
    |   File "/opt/python/pynamodb/connection/base.py", line 1203, in query
    |     raise ValueError("Table {} has no index: {}".format(table_name, index_name))
    | ValueError: Table <tablename> has no index: <index_name>

PynamoDB Version: 6.1.0

Any clue why this might be happening? I am trying to create a minimal, complete, and verifiable example (MCVE), but so far I am not successful.

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