99x / 99x/serverless-dynamodb-local
Global Secondary Index is not working
- Dominant language
- JavaScript
- Stars
- 621
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
I defined dynamodb table with global secondary index.
I requested query with GSI.
But an error occurred.
Is This plugin not support GSI?
`request.vtl`
```vtl
{
"version" : "2017-02-28",
"operation" : "Query",
"index" : "groupId-index",
"query" : {
"expression": "groupId = :groupId",
"expressionValues" : {
":groupId" : $util.dynamodb.toDynamoDBJson($ctx.args.groupId)
}
}
}
```
`serverless.yml`
```yaml
resources:
Resources:
UserTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: UserTable
KeySchema:
-
AttributeName: id
KeyType: HASH
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
-
AttributeName: groupId
AttributeType: S
BillingMode: PAY_PER_REQUEST
GlobalSecondaryIndexes:
-
IndexName: groupId-index
KeySchema:
- AttributeName: groupId
KeyType: HASH
Projection:
ProjectionType: ALL
```
Error
```
Error while executing Local DynamoDB
{
"version": "2017-02-28",
"operation": "Query",
"index": "groupId-index",
"query": {
"expression": "groupId = :groupId",
"expressionValues": {
":groupId": {
"S": "group-001"
}
}
}
}
ValidationException: The table does not have the specified index: groupId-index
```
```yaml
plugins:
- serverless-appsync-plugin
- serverless-dynamodb-local
- serverless-appsync-simulator
- serverless-offline
```
Contributor guide
Research direction
Reproduce the failure with the shown request.vtl, serverless.yml, and plugin configuration, then inspect how the local table is created and whether groupId-index is present. Confirm whether the query succeeds against the local table; if GSI support is absent, document that limitation and its expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100