-
Notifications
You must be signed in to change notification settings - Fork 216
Incorrect IAM Permissions generated when S3 Bucket Reference used #647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
danrivett
added a commit
to danrivett/serverless-step-functions
that referenced
this issue
Apr 19, 2025
HI. it is blocking to me too. any chance we can settle it? |
@mikewongblinx please have a look at PR #648 Maybe you can help out adding the missing tests? |
danrivett
added a commit
to danrivett/serverless-step-functions
that referenced
this issue
Jun 13, 2025
danrivett
added a commit
to danrivett/serverless-step-functions
that referenced
this issue
Jun 13, 2025
danrivett
added a commit
to danrivett/serverless-step-functions
that referenced
this issue
Jun 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
I'm trying to do an S3
putObject
using and S3 SDK service integration that references an S3 bucket created in the sameserverless.yml
file.I tried to reference the bucket's name using
Ref: bucketResource
something like as follows:But it fails to generate the correct IAM policy definition. It generates something like:
(Notice the
[object Object]
instead of the resolved S3 bucket name).Whereas it generates the correct IAM permissions when I invoke a Lambda function that references a Lambda function defined in the same `serverless.yml file.
Possible Root Cause
From my investigation it looks like the
getS3ObjectPermissions()
function incompileIamRole.js
(here) is too simplistic and just assumes thebucket
field specified is a string literal rather than possibly being a reference.As I mentioned above, references and other intrinsic functions such as
Fn::GetAtt
are supported for other resources, but it seems the IAM permissions generation for S3 resources is currently lacking this.Possible Solution
I modified the
getS3ObjectPermissions()
function locally to implement a possible solution, and it seems to work for me. I have submitted PR #648 for consideration.I am happy to modify it as needed, or have it superseded by a better solution, but it would be great to fix this.
The text was updated successfully, but these errors were encountered: