-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/aws-sesRelated to Amazon Simple Email ServiceRelated to Amazon Simple Email ServicebugThis issue is a bug.This issue is a bug.needs-reproductionThis issue needs reproduction.This issue needs reproduction.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
🐛 Bug Report
What is the problem?
Unable to create SES Rule with s3 action from existing rule set.
Reproduction Steps
I am trying to create a SES Rule from an existing rule set which actions are to s3 bucket and sns topic as shown below.
const ruleSet = ReceiptRuleSet.fromReceiptRuleSetName(this, 'RuleSet', props.ruleSetName);
const emailTopic = new Topic(this, 'Topic', {
displayName: 'Email Scrapper'
});
const emailBucket = new Bucket(this, 'Bucket');
ruleSet.addRule(
'Rules',
{
recipients: ['reflaunt.email'],
actions: [
new ReceiptRuleS3Action({
bucket: emailBucket,
topic: emailTopic
})
]
}
);
But everytime I deploy, I always receive this error
Could not write to bucket: emailscrapperstack-dev-emailscrapperobjectobjectb-1xx3t61zt8bxb (Service: AmazonSimpleEmailService; Status Code: 400; Error Code: InvalidS3Configuration; Request ID: faff6bc9-e2ae-4c34-863c-39d3b59f23d1)
Then I realized that the s3 bucket policy was not configured when the rule is added, so for now I did a hacky-fix by adding s3 resource policy dependency to the rule set.
const cfnBucketPolicy = emailBucket.node.findChild("Policy").node.findChild("Resource") as CfnBucketPolicy;
ruleSet.node.addDependency(cfnBucketPolicy);
Is there any better way to achieve this ?
Also the strange thing is, I don't have the issue with the sns topic, even the rule set is not depending on the sns policy.
Verbose Log
Could not write to bucket: emailscrapperstack-dev-emailscrapperobjectobjectb-1xx3t61zt8bxb (Service: AmazonSimpleEmailService; Status Code: 400; Error Code: InvalidS3Configuration; Request ID: faff6bc9-e2ae-4c34-863c-39d3b59f23d1)
Environment
- CDK CLI Version: 1.4.0
- Module Version: 1.4.0
- OS: ubuntu 18.04
- Language: TypeScript
Other information
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-sesRelated to Amazon Simple Email ServiceRelated to Amazon Simple Email ServicebugThis issue is a bug.This issue is a bug.needs-reproductionThis issue needs reproduction.This issue needs reproduction.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.