I’m using s3.getObject
within the S3 AWS SDK in JavaScript. This S3 object may legitimately not exist, and I’m handling that condition fine in my application.
However, in Datadog I’m seeing so many spam logs of the NoSuchKey
error. Because I’m not logging that myself, and I’m not leaving the error uncaught, I’m guessing it’s the SDK itself that is logging this.
I’ve tried replacing the logger inside S3 with just a null logger, however these NoSuchKey
errors are still somehow making it to Datadog.
I’m using the following code which I thought would work:
const nullLogger = {
log: () => {},
write: () => {},
error: () => {},
warn: () => {},
debug: () => {}
};
const s3 = new AWS.S3({
logger: nullLogger,
region
});
The getObject
usage is within a try/catch, and the error is being correctly handled.