Robert
05/10/2022, 1:10 PMconst uploadPublicBucket = props.uploadPublicBucket;
apiGateway.addRoutes(this, {
'GET /users': {
function: {
functionName: `fdm-${id}-${scope.stage}-get-users`,
handler: 'services/field-data-api/handlers/user.get',
permissions: [
'cognito-idp:ListUsers',
'cognito-idp:DescribeUserPool',
[uploadPublicBucket.bucketArn, 'ListBucket'],
],
},
},
});
But I get this error when I run sst start
, Error: The specified permissions are not supported.
I'm pretty sure there's a way that I can give permission to list a specific bucket to a specific lambda function, if anyone has any hint for me I'd appreciated 🙂manitej
05/10/2022, 1:13 PMRobert
05/10/2022, 1:19 PMattachPermissions
, which is the same as just passing the permissions directly when creating the lambda. The only difference is that they do it with a topic, and a table instead of a bucket.
I've tried passing the s3 object, then the s3 arn. I've tried with ListBucket
and s3.ListBucket
as permissions. Both every time I get an error. So I figured someone else probably did it and could give me a hintRobert
05/10/2022, 1:22 PM[uploadPublicBucket, 'ListBucket']
but when I try this I then get Error: The specified grant method is incorrect.
thdxr
05/10/2022, 1:24 PM.grantXXX
methods on the bucketRobert
05/10/2022, 1:25 PMRobert
05/10/2022, 1:26 PMgrantXXX
way is the same as when doing it directly on the bucket yeah. Something like bucket.grantXXX(...)
thdxr
05/10/2022, 1:26 PMthdxr
05/10/2022, 1:26 PMnew iam.PolicyStatement({
actions: [...],
effect: iam.Effect.ALLOW,
resources: [...],
}),
Robert
05/10/2022, 1:27 PM