Seth Geoghegan
04/14/2022, 11:44 PMSeth Geoghegan
04/14/2022, 11:45 PMType '{ function: string; events: "object_created"[]; }[]' is not assignable to type 'Record<string, FunctionInlineDefinition | BucketFunctionNotificationProps | Queue | BucketQueueNotificationProps | Topic | BucketTopicNotificationProps>'.
Index signature for type 'string' is missing in type '{ function: string; events: "object_created"[]; }[]'.ts(2322)
Seth Geoghegan
04/14/2022, 11:45 PMconst bucket = new sst.Bucket(stack, "Bucket", {
notifications: [
{
function: "src/notification.main",
events: ["object_created"],
},
],
});
Tanner Bindrup
04/14/2022, 11:50 PMtype 'Record<string, ...
bit in the error output means that the expected value for the events
key has been changed from an array to an object. No guarantees here, but that's what's been working for us with similar errors so farTanner Bindrup
04/14/2022, 11:50 PMSeth Geoghegan
04/15/2022, 12:07 AMTanner Bindrup
04/15/2022, 12:11 AMbucket.addNotifications(...)
, but based on the changes we had to make, I'd say try something like this:
const bucket = new sst.Bucket(stack, "Bucket", {
notifications: {
keyThatDoesntMatter: {
function: "src/notification.main",
events: ["object_created"],
},
},
});
Seth Geoghegan
04/15/2022, 12:12 AMSeth Geoghegan
04/15/2022, 12:14 AMFrank
Frank
const bucket = new sst.Bucket(stack, "Bucket", {
notifications: {
keyThatDoesntMatter: {
function: "src/notification.main",
events: ["object_created"],
},
},
});
Frank
Seth Geoghegan
04/15/2022, 1:47 AM