How do I authorizer all users to access a GSI? (In my case, the userIndex)
I can access the primary-index just fine. I successfully authorized all users to access the primary-index the following way:
Here I target the primary-index, which works just fine
Here I target the GSI, which doesn't work:
I tried adding dynamodb to my AuthStack
at the two places you can see in the image below (to no avail). I doubt changing the AuthStack will do anything, since it is a lambda function that is making the Put
request to DynamoDb (I might be wrong though).
I figured it out.
First of all, you are not supposed to write to a gsi, only read.
Secondly, when wantin gto query a gsi, you have to specify the TableName
together with IndexName
.
The following works