I created a Topic and added two subscribers to it....
# help
s
I created a Topic and added two subscribers to it. Then i added that topic to my s3bucket notifications. In the First time i tested i got a SNSEvent to my Lambda function. But now I'm getting a S3Event 🙄 Is it possible?
Copy code
const topic = new sst.Topic(this, "imagePut", {
      subscribers: [
        {
          function: {
            handler: "src/s3/resize-image.main",
          },
        },
        {
          function: {
            handler: "src/s3/analize-image.main",
          },
        },
      ],
    });

const bucket = new sst.Bucket(this, "Bucket", {
      s3Bucket: {
        bucketName: `${scope.stage}-absc-files`,
      },
      notifications: [
        {
          topic: topic,
          notificationProps: {
            events: [s3.EventType.OBJECT_CREATED],
            filters: [{ prefix: "original-images/" }],
          },
        },
      ],
});
I had to use these to get S3 object from SNS message.
Copy code
var snsMsgString = JSON.stringify(event.Records[0].Sns.Message);
   var snsMsgObject = getSNSMessageObject(snsMsgString);
   var srcBucket = snsMsgObject.Records[0].s3.bucket.name;
   var srcKey = snsMsgObject.Records[0].s3.object.key;
f
Hey @Sahan Amadoruge, you setup looks right. Should be consistently receiving SNSEvent.