node_modules: update (#307)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurla
2026-08-07 08:08:22 +02:00
committed by GitHub
parent 5cdad7c44d
commit 8de3c31270
35 changed files with 1023 additions and 339 deletions
+43 -13
View File
@@ -43,11 +43,12 @@ class SESTransport extends EventEmitter {
getRegion(cb) {
if (this.ses.sesClient.config && typeof this.ses.sesClient.config.region === 'function') {
// promise
return this.ses.sesClient.config
.region()
.then(region => cb(null, region))
.catch(err => cb(err));
// Resolve the region provider. Use the two-argument form of then() so that a
// synchronous throw from cb is not recaught here and used to invoke cb a second time.
return this.ses.sesClient.config.region().then(
region => cb(null, region),
err => cb(err)
);
}
return cb(null, false);
}
@@ -150,8 +151,27 @@ class SESTransport extends EventEmitter {
region = 'us-east-1';
}
const command = new this.ses.SendEmailCommand(sesMessage);
const sendPromise = this.ses.sesClient.send(command);
let sendPromise;
try {
// command construction or dispatch can throw synchronously on a
// misconfigured SDK; surface it as a single error callback instead
// of letting it escape into getRegion's promise chain
const command = new this.ses.SendEmailCommand(sesMessage);
sendPromise = this.ses.sesClient.send(command);
} catch (err) {
tagSesError(err);
this.logger.error(
{
err,
tnx: 'send'
},
'Send error for %s: %s',
messageId,
err.message
);
setImmediate(() => callback(err));
return;
}
sendPromise
.then(data => {
@@ -159,7 +179,7 @@ class SESTransport extends EventEmitter {
region = 'email';
}
callback(null, {
const info = {
envelope: {
from: envelope.from,
to: envelope.to
@@ -167,7 +187,11 @@ class SESTransport extends EventEmitter {
messageId: '<' + data.MessageId + (!/@/.test(data.MessageId) ? '@' + region + '.amazonses.com' : '') + '>',
response: data.MessageId,
raw
});
};
// invoke the callback outside the promise chain so a throw from it
// is not recaught by .catch() and used to call it a second time
setImmediate(() => callback(null, info));
})
.catch(err => {
tagSesError(err);
@@ -180,7 +204,7 @@ class SESTransport extends EventEmitter {
messageId,
err.message
);
callback(err);
setImmediate(() => callback(err));
});
});
})
@@ -222,10 +246,16 @@ class SESTransport extends EventEmitter {
// the region value is not used for anything when verifying, but the lookup
// exercises the client configuration the same way as send() does
this.getRegion(() => {
const command = new this.ses.SendEmailCommand(sesMessage);
const sendPromise = this.ses.sesClient.send(command);
let sendPromise;
try {
const command = new this.ses.SendEmailCommand(sesMessage);
sendPromise = this.ses.sesClient.send(command);
} catch (err) {
setImmediate(() => cb(err));
return;
}
sendPromise.then(() => cb(null)).catch(err => cb(err));
sendPromise.then(() => setImmediate(() => cb(null))).catch(err => setImmediate(() => cb(err)));
});
return promise;