You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example query below: const { Items, LastEvaluatedKey } = await this.model. query(objectId). usingIndex('objectId-updatedAt-index'). startKey(objectId, startKey || "_"). limit(limit || 20). attributes(this.defaultAttributes). execAsync();
The generated request is here: { IndexName: 'objectId-updatedAt-index', ExclusiveStartKey: { objectId: 'alpha1_customer_1', noteId: '_' }, Limit: 20, ProjectionExpression: '#objectId,#noteId,#updatedAt,#message', ExpressionAttributeNames: { '#objectId': 'objectId', '#noteId': 'noteId', '#updatedAt': 'updatedAt', '#message': 'message' } } }
It generates the following error: ValidationException: The provided starting key is invalid
The problem is that the generated start key has the attributes objectId and noteId, when the index requires objectId and updatedAt.
I am going to submit a PR for this shortly.
The text was updated successfully, but these errors were encountered:
startKey() provides the value for ExclusiveStartKey in the DynamoDB api call. The only valid value for ExclusiveStartKey is the value returned as LastEvaluatedKey from the previous query or scan operation, so correct functionality can be restored by changing the following functions:
Example query below:
const { Items, LastEvaluatedKey } = await this.model. query(objectId). usingIndex('objectId-updatedAt-index'). startKey(objectId, startKey || "_"). limit(limit || 20). attributes(this.defaultAttributes). execAsync();
The generated request is here:
{ IndexName: 'objectId-updatedAt-index', ExclusiveStartKey: { objectId: 'alpha1_customer_1', noteId: '_' }, Limit: 20, ProjectionExpression: '#objectId,#noteId,#updatedAt,#message', ExpressionAttributeNames: { '#objectId': 'objectId', '#noteId': 'noteId', '#updatedAt': 'updatedAt', '#message': 'message' } } }
It generates the following error:
ValidationException: The provided starting key is invalid
The problem is that the generated start key has the attributes objectId and noteId, when the index requires objectId and updatedAt.
I am going to submit a PR for this shortly.
The text was updated successfully, but these errors were encountered: