sparse-intern-71089
02/14/2023, 12:35 PMbrave-planet-10645
02/14/2023, 2:58 PMcallbackFunction
resource then yes you can point it at the handlerbrave-planet-10645
02/14/2023, 3:02 PMbrave-planet-10645
02/14/2023, 3:02 PMbrave-planet-10645
02/14/2023, 3:03 PMCallbackFunction
pretty much everywhere in the AWS provider where you specify a Function
resourcebrave-planet-10645
02/14/2023, 3:04 PMbrave-planet-10645
02/14/2023, 3:05 PMimport * as aws from "@pulumi/aws";
import { BucketEvent } from "@pulumi/aws/s3";
export const onObjectCreatedLambda = (e: BucketEvent) => {
const db = new aws.sdk.DynamoDB.DocumentClient();
for (const rec of e.Records || []) {
const key = rec.s3.object.key;
let params = {
TableName: process.env.TABLENAME || "",
Item: {
'objectkey': key,
'timestamp': new Date().toISOString()
}
};
db.put(params, function (err, data) {
if (err) {
console.log("Error", err);
} else {
console.log(`Written ${key} to db`);
}
});
}
};
bright-wall-79582
02/14/2023, 3:23 PMbright-wall-79582
03/16/2023, 12:48 PMwhich could not be serialized because it was a native code function.
or
arrow function captured 'this'. Assign 'this' to another name outside function and capture that.
is the only way to get around these to revert to using Function and then use FileAssets?brave-planet-10645
03/16/2023, 5:20 PMbright-wall-79582
03/17/2023, 7:41 AM