Policy Attached to 0 entities Error

The Issue

If the github webhook not working and you’re seeing this error:

The policy is attached to 0 entities but it must be attached to a single role

Here’s a screenshot:

The CodeBuild console seems to be confused. Believe the CodeBuild wizard tries to creates an conventional IAM policy and attaches it to the CodeBuild project. Cody creates an IAM role via code and attaches it to the the CodeBuild project though. Hence the confusion.

Now, if you’re webhook is not working for whatever reason. Maybe it’s out of sync on GitHub. Then CloudFormation doesn’t seem to update the webhook.


A workaround is to delete both:

  1. Service role permissions - by unchecking the checkbox
  2. Primary source webhook events - by unchecking the checkbox

Screenshots provided below:

Then make a slight change to the .cody/project.rb and run cody deploy. You can just remove the webhook, deploy, add back the webhook and deploy again. This syncs back up CodeBuild with CloudFormation and the webhook should be fixed.


Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub, and contributions are encouraged and welcomed. We love pull requests from you!