-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
(aws-s3-notifications): Unable to validate the following destination configurations. #18090
Comments
hi @NGL321 Switching to Here is what I changed to:
|
I even tried adding the role to the function attributes config, without success
|
Hi @NGL321, I am trying to plan feature development around this issue. I am wondering if it's possible to get an idea of when this issue might be resolved. This way I can decide if it makes sense to look into a workaround. Thanks in advance for any details. |
@NGL321 Have any updates on this? It's really becoming a huge blocker for us. |
We have met the same issue, but in SQS case. And we found this is an occasional issue. We pointed the S3 event notification to an SQS with the following code, // Add the S3 event on the log bucket with the target is sqs queue
logBucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.SqsDestination(logEventQueue), {
prefix: props.logBucketPrefix
}) but got the same error And we had a look at the CloudWatch Log, but we cannot find some useful information. Here is the CloudWatch Log:
And the workaround is delete the CloudFormation Stack and redeploy it. |
I have also been coming across the same issue, my work around was to go and manually create it via console and then delete the same event notification. After doing this I was able to successfully deploy the event notification to AWS. Not an ideal work around, but at least our CDK is not complaining.... Something behind the scenes with AWS must get created and not deleted following this. |
I had the same issue. You need to set "sameEnvironment" flag to "true" in fromFunctionAttributes() to allow CDK has permission to update your external lambda function. something like:
|
We have the same issue, and we create the bucket and the queue directly over the cdk script. Edit: |
I have a similar issue when adding a event on a bucket that is managed by another account (cross account) to run a lambda. This error can appears when the account of the bucket is missing permissions for invoking the lambda. According to AWS documentation, there are two types of permissions required:
I must add new resource-based policy because the current policy defined by the addEventNotification uses the current account in the source account property. The current code is : this.fn.addPermission(permissionId, {
sourceAccount: Stack.of(bucket).account, // <- The issue is here with the account of the stack, not the account of the bucket
principal: new iam.ServicePrincipal('s3.amazonaws.com'),
sourceArn: bucket.bucketArn,
scope: bucket,
}); To fix the issue, add a new permission on the lambda with the correct account : lambda.addPermission(permissionId, {
sourceAccount: '12345678901234', // Owner Account id of the bucket
principal: new iam.ServicePrincipal('s3.amazonaws.com'),
sourceArn: bucket.bucketArn,
}); I don't find any way to get the account id of a bucket. |
We had the same issue. I contacted AWS support, and they were able to tell us that we had an existing event notification in the bucket for which the destination didn't exist anymore. We removed that notification and afterwards CDK could create the new event notification configuration correctly. |
By manually adding The following is the boto3 debug log b'<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>InvalidArgument</Code><Message>Unable to validate the following destination configurations</Message><ArgumentName1>arn:aws:sqs:eu-north-1:*****:tCaT-clo-cognito-571690-CLFlbConfUploadingEventQueueAB242C04-ittCZ64K0mAg</ArgumentName1><ArgumentValue1>Permissions on the destination queue do not allow S3 to publish notifications from this bucket</ArgumentValue1><RequestId>SMY8RNEEN1PY4QB9</RequestId><HostId>YxuzvmGghxa3uVJ/o3OPB2wshteBI+1oWQWxSqY5g0ZKm5aLeW/tHBSIDXWiw8sOafq7NdD/BaI=</HostId></Error>' The following is how I manually edit the generated template.
|
Gosh, can't thank you enough for sharing. I had to recreate the custom resource, in this case a Lambda function, reassign the resource-base policy and then I was finally able to delete the notification rule. |
I am facing the same issue when adding a new SNS event notification to my already-created S3 bucket. The bucket is created using CDK only. Error - let bucket = new s3.Bucket(this, "Bucket", {
bucketName: bucketName
}
// new code
const snsTopic = sns.Topic.fromTopicArn(
this,
`snsTopic`,
"arn"
);
bucket.addEventNotification(
s3.EventType.OBJECT_CREATED
new s3n.SnsDestination(snsTopic)
); Is there a workaround? Similar to #28915 |
@oste I notice that you're using imported lambda function. For imported function, we will set the property canCreatePermission to false, see code. Since this property is set to false, then when binding the LambdaDestination to s3 event notifications, it will attempt to create lambda permisison (see code) but failed to create since canCreatePermissions is false. Without necessary permission, creating a s3 event notification will then fail due to Unable to validate the following destination configurations |
This fixed it for me: https://sagargiri.com/s3-event-notification-issue $ aws lambda add-permission |
What is the problem?
Cloudwatch Log Stream didn't seem to have further details.
Reproduction Steps
What did you expect to happen?
Bucket would have an event notification for the given config pointing to the lambda.
What actually happened?
Error shown was generated.
CDK CLI Version
2.2.0 (build 4f5c27c)
Framework Version
n/a
Node.js Version
16.11
OS
OSX
Language
Typescript
Language Version
TypeScript (4.4.4)
Other information
From what I have read this seems to be caused by a missing policy on either the S3 Bucket or Lambda function or both. My attempts to add these policies have not worked.
Perhaps this issue stems from both resources(lambda, bucket) being imported, and thus
addEventNotification
is not able to add the required policies. Any workaround would be greatly apprecaited.The text was updated successfully, but these errors were encountered: