aws / aws/aws-cdk

(aws-s3-notifications): Unable to validate the following destination configurations.

Open
#18,090 19 comments 12 reactions 1 assignee Claimed by @GavinZZ View on GitHub
@aws-cdk/aws-s3-notifications bug p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### What is the problem?

```
Error: An error occurred (InvalidArgument) when calling the PutBucketNotificationConfiguration operation: Unable to validate the following destination configurations. See the details in CloudWatch Log Stream:
```

Cloudwatch Log Stream didn't seem to have further details.

### Reproduction Steps

```
const importedBucketFromName = s3.Bucket.fromBucketName(
this,
'imported-bucket-from-name',
'bucket-name'
);

const importedLambdaFromArn = lambda.Function.fromFunctionArn(
this,
'external-lambda-from-arn',
'lambda-arn'
);

importedBucketFromName.addEventNotification(
s3.EventType.OBJECT_CREATED,
new s3n.LambdaDestination(importedLambdaFromArn),
{ prefix: 'test/', suffix: '.yaml' }
);
```

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.