Adrian Schweizer
03/24/2022, 6:35 PMUncaught Exception {"errorType":"TypeError","errorMessage":"Cannot read property 'push' of undefined",
Adrian Schweizer
03/24/2022, 7:12 PMUncaught Exception {"errorType":"TypeError","errorMessage":"Cannot read property 'push' of undefined","code":"TypeError","message":"Cannot read property 'push' of undefined","time":"2022-03-24T18:44:22.378Z","stack":["TypeError: Cannot read property 'push' of undefined"," at Object.debug [as log] (/home/adsc/projects/convento/.build/src/participations/mailReminder.js:56:8)"," at Request.LOG_REQUEST (/home/adsc/projects/convento/node_modules/aws-sdk/lib/event_listeners.js:608:16)"," at Request.callListeners (/home/adsc/projects/convento/node_modules/aws-sdk/lib/sequential_executor.js:106:20)"," at Request.emit (/home/adsc/projects/convento/node_modules/aws-sdk/lib/sequential_executor.js:78:10)"," at Request.emit (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:686:14)"," at Request.transition (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:22:10)"," at AcceptorStateMachine.runTo (/home/adsc/projects/convento/node_modules/aws-sdk/lib/state_machine.js:14:12)"," at /home/adsc/projects/convento/node_modules/aws-sdk/lib/state_machine.js:26:10"," at Request.<anonymous> (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:38:9)"," at Request.<anonymous> (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:688:12)"]}
Adrian Schweizer
03/24/2022, 7:14 PMAdrian Schweizer
03/24/2022, 7:19 PMexport async function consumer(event) {
for (const record of event.Records) {
console.log(record.body);
const { mail, participation, event } = JSON.parse(record.body);
//await sendMail(mail, participation, event);
console.log("mail sent");
// await dynamodb.update({
// TableName: process.env.TABLE_NAME_PARTICIPATIONS,
// Key: {
// participationId: participation.participationId,
// },
// UpdateExpression: "SET reminderSent = :reminderSent",
// ExpressionAttributeValues: {
// ":reminderSent": true,
// },
// ReturnValues: "ALL_NEW",
// });
console.log("dynamodb updated");
}
return {};
}
Adrian Schweizer
03/24/2022, 7:20 PMAdrian Schweizer
03/24/2022, 7:31 PMAdrian Schweizer
03/24/2022, 7:32 PMAdrian Schweizer
03/24/2022, 8:04 PMexport async function consumer(event) {
const client = new AWS.DynamoDB.DocumentClient();
for (const record of event.Records) {
const { mail, participation, event } = JSON.parse(record.body);
console.log(process.env.TABLE_NAME_PARTICIPATIONS);
console.log(mail);
console.log(participation.participationId);
console.log(event.eventId);
await client.update({
TableName: process.env.TABLE_NAME_PARTICIPATIONS,
Key: {
participationId: participation.participationId,
},
UpdateExpression: "SET reminderSent = :reminderSent",
ExpressionAttributeValues: {
":reminderSent": true,
},
}).promise();
console.log("all done");
}
return {};
}
Adrian Schweizer
03/24/2022, 8:05 PMAdrian Schweizer
03/24/2022, 8:52 PMAdrian Schweizer
03/24/2022, 9:01 PMAdrian Schweizer
03/24/2022, 9:46 PMAdrian Schweizer
03/24/2022, 9:46 PMAdrian Schweizer
03/24/2022, 9:46 PMAdrian Schweizer
03/24/2022, 9:47 PMAdrian Schweizer
03/24/2022, 9:51 PMAdrian Schweizer
03/24/2022, 10:00 PMAWS.config.logger = console;
the error doesn't occurFrank
console.log(AWS.config.logger)
, is it undefined before u set it to console
?Adrian Schweizer
03/24/2022, 10:40 PMAdrian Schweizer
03/24/2022, 10:40 PMAdrian Schweizer
03/24/2022, 10:41 PMAdrian Schweizer
03/24/2022, 10:41 PMAdrian Schweizer
03/24/2022, 10:44 PM{ log: [Function: debug] }
Adrian Schweizer
03/24/2022, 10:45 PMAdrian Schweizer
03/24/2022, 10:46 PMAdrian Schweizer
03/25/2022, 3:51 PM"TypeError: Cannot read property 'push' of undefined"," at Object.debug [as log] (/home/adsc/projects/convento/.sst/artifacts/dev3-convento-cron-ReminderMailQueue-Consumer_ReminderMailQueue/src/participations/mailReminder.js:12106:8)
Adrian Schweizer
03/25/2022, 3:52 PMAdrian Schweizer
03/25/2022, 3:53 PMthdxr
03/25/2022, 3:54 PMthdxr
03/25/2022, 3:54 PMNODE_OPTIONS=--enable-source-maps
thdxr
03/25/2022, 3:54 PMAdrian Schweizer
03/25/2022, 3:54 PMAdrian Schweizer
03/25/2022, 3:55 PMAdrian Schweizer
03/25/2022, 3:56 PMAdrian Schweizer
03/25/2022, 3:59 PMAdrian Schweizer
03/25/2022, 4:03 PMAdrian Schweizer
03/25/2022, 4:04 PMUncaught Exception {"errorType":"TypeError","errorMessage":"Cannot read property 'push' of undefined","code":"TypeError","message":"Cannot read property 'push' of undefined","time":"2022-03-25T16:02:11.904Z","stack":["/home/adsc/projects/convento/src/util/debug.js:10"," logs.push({"," ^","","TypeError: Cannot read property 'push' of undefined"," at Object.debug (/home/adsc/projects/convento/src/util/debug.js:10:9)"," at Request.LOG_REQUEST (/home/adsc/projects/convento/node_modules/aws-sdk/lib/event_listeners.js:608:16)"," at Request.callListeners (/home/adsc/projects/convento/node_modules/aws-sdk/lib/sequential_executor.js:106:20)"," at Request.emit (/home/adsc/projects/convento/node_modules/aws-sdk/lib/sequential_executor.js:78:10)"," at Request.emit (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:686:14)"," at Request.transition (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:22:10)"," at AcceptorStateMachine.runTo (/home/adsc/projects/convento/node_modules/aws-sdk/lib/state_machine.js:14:12)"," at /home/adsc/projects/convento/node_modules/aws-sdk/lib/state_machine.js:26:10"," at Request.<anonymous> (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:38:9)"," at Request.<anonymous> (/home/adsc/projects/convento/node_modules/aws-sdk/lib/request.js:688:12)"]}
Adrian Schweizer
03/25/2022, 4:05 PMimport util from "util";
import AWS from "aws-sdk";
let logs;
// Log AWS SDK calls
AWS.config.logger = { log: debug };
export default function debug() {
logs.push({
date: new Date(),
string: util.format.apply(null, arguments),
});
}
export function init(event) {
logs = [];
// Log API event
debug("API event", {
body: event.body,
pathParameters: event.pathParameters,
queryStringParameters: event.queryStringParameters,
});
}
export function flush(e) {
logs.forEach(({ date, string }) => console.debug(date, string));
console.error(e);
}
Adrian Schweizer
03/25/2022, 4:05 PMAdrian Schweizer
03/25/2022, 4:07 PMAdrian Schweizer
03/25/2022, 4:09 PMAdrian Schweizer
03/25/2022, 4:10 PMAdrian Schweizer
03/25/2022, 4:10 PMAdrian Schweizer
03/25/2022, 4:11 PMAdrian Schweizer
03/25/2022, 4:12 PMAdrian Schweizer
03/25/2022, 4:13 PMAdrian Schweizer
03/25/2022, 4:13 PMthdxr
03/25/2022, 4:27 PMAdrian Schweizer
03/25/2022, 4:35 PMAdrian Schweizer
03/25/2022, 4:36 PMAdrian Schweizer
03/25/2022, 4:37 PMFrank
Frank
thdxr
03/25/2022, 8:27 PMthdxr
03/25/2022, 8:27 PMAdrian Schweizer
03/25/2022, 10:19 PM