# Wrong execution role for custom resources function?

**URL:** <https://forum.serverless.com/t/wrong-execution-role-for-custom-resources-function/10110>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [December 19, 2019, 2:21pm UTC](https://forum.serverless.com/t/wrong-execution-role-for-custom-resources-function/10110 "2019-12-19T14:21:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JakubMatejka](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jakubmatejka/32/2802_2.png) [@JakubMatejka](https://forum.serverless.com/u/JakubMatejka)\
**Post date:** [December 19, 2019, 2:21pm UTC](https://forum.serverless.com/t/wrong-execution-role-for-custom-resources-function/10110/1 "2019-12-19T14:21:10Z")

</div>

Hi,  
I would like to use s3 event with an existing s3 bucket, so I added `existing: true` to the serverless.yml according to the docs. My service uses custom IAM roles for lambda execution and deployment (so the serverless.yml has filled `provider.role` and `provider.cfnRole`).

But the deployment fails on a weird error that the Cloudformation role is trying to assume itself. See the screenshot:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/serverless/original/2X/4/415692ed58efdf4b98926b045a78623720c2a3cc.png)

After some debugging I found out that the `cfnRole` is passed as execution role of the custom lambda function: [https://github.com/serverless/serverless/blob/master/lib/plugins/aws/customResources/index.js#L171](https://github.com/serverless/serverless/blob/master/lib/plugins/aws/customResources/index.js#L171)  
Isn’t that a bug? I would say that there should be `serverless.service.provider.role` instead. Or am I wrong?
