Guy Shechter
07/16/2021, 4:33 AMconst incomingBucket = new s3.Bucket(this, 's3Incoming', {
bucketName: `${scope.stage}-data-files`,
removalPolicy: cdk.RemovalPolicy.DESTROY,
});
const incomingQueue = new sqs.Queue(this, 'sqsIncoming', {
queueName: `${scope.stage}-incoming`
});
incomingBucket.addObjectCreatedNotification(incomingQueue);
I get the following error:
Error: ENOENT: no such file or directory, open 'app/.build/lib/lambda/index.py'
at Object.openSync (node:fs:582:3)
at Object.readFileSync (node:fs:450:35)
at new NotificationsResourceHandler (app/node_modules/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts:87:29)
at Function.singleton (pp/node_modules/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts:41:16)
at BucketNotifications.createResourceOnce (app/node_modules/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts:105:52)
at BucketNotifications.addNotification (app/node_modules/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts:54:27)
at Bucket2.addEventNotification (app/node_modules/@aws-cdk/aws-s3/lib/bucket.ts:338:24)
at Bucket2.addObjectCreatedNotification (app/node_modules/@aws-cdk/aws-s3/lib/bucket.ts:343:17)
at new MyStack (app/lib/MyStack.js:26:20)
It looks like CDK needs to create a lambda to connect the notification, but SST hasn’t added it to the build?
I would do this directly with SST but it seems that Lambda functions are the only notification type supported from sst.Bucket.Frank
Frank
Frank
Guy Shechter
07/16/2021, 11:49 AMFrank
const myQueue = new Queue(this, "MyQueue");
new Bucket(this, "Bucket", {
notifications: [myQueue],
});
More examples here - https://docs.serverless-stack.com/constructs/Bucket#configuring-queue-notifications