on first invoke when lambda pulls new image or creates container, if result of first invoke is error (if i intentionally send bad request params) slack transport will send error only when that container is killed (aprox. 5mins after there are no new requests), if i try new requests slack transport will send them to slack
This is probably related to the async error handling of your Slack transport. If the async execution is not handled properly, the lambda will freeze before the error is sent to the webhook. The reason why it's sent later on, it's because of the lifecycle:
SIGSTOP
signal)SIGCONT
, because you can't stop a frozen process) - that would explain the execution you had after 5 minutesSIGTERM
)SIGTERM
is failing, it will force a stop with a SIGKILL
signalwinston cloudwatch transport will not log any error to cloudwatch during container lifetime but will send them all after container is killed when lambda decide to do that
The issue seems to be similar to the previous one. In that case the project is using callback based functions, and I guess your code is using promises with async/await. You should be able to make it work correctly by using promisify util like this example:
const winstonCloudWatch = new WinstonCloudWatch({
name: 'using-kthxbye',
logGroupName: 'testing',
logStreamName: 'another',
awsRegion: 'us-east-1',
awsAccessKeyId: await getSecretValue('AWS_ACCESS_KEY_ID'),
awsSecretKey: await getSecretValue('AWS_SECRET_KEY'),
});
kthxbyeAsync = promisify(winstonCloudWatch.kthxbye).bind(winstonCloudWatch);
winston.add(winstonCloudWatch);
winston.add(new winston.transports.Console({
level: 'info'
}));