Default Lamda Execution Policy Can't Use Global Secondary Indexes
Describe the bug Using the amplify-cli to create a REST API backed by DynamoDB, complete with a global secondary index, results in a Lamda IAM role & policy that can't query the GSI.
To Reproduce Steps to reproduce the behavior:
amplify initamplify add api2a. Select REST, select CRUD backed by Dynamo, create new table, specify enough columns for a primary key, sort key, and GSI.amplify push- Attempt to query GSI either through code or direct API endpoint
Expected behavior The Lamda CloudFormation template should add the Dynamo index(es) to the allowed resource section under the lamda-execution-policy.
Desktop (please complete the following information):
- OS: Mac OS X Sierra
- Browser: Chrome
I've just been poking my way around the codebase, but I believe the fix for this will end up in this file if I'm understanding things correctly: https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-category-function/provider-utils/awscloudformation/cloudformation-templates/lambda-cloudformation-template.json.ejs#L74
@johnford2002 You're right. If you can submit a quick PR for the same, I could review it and we could ship this in our next release. Thanks!
Hi @kaustavghosh06, is there a manual workaround to query on a secondary index? I am struggling for a while on this
I'm also blocked on this. Any updates?
We've merged a fix for this. This would be a part of our next npm release.
Cool @kaustavghosh06. Patiently waiting this side. Any idea of ETA? Thanks.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.