This document outlines how to migrate to the latest version of the Reliability Kit middleware-log-errors package. Throughout this guide we use the following emoji and labels to indicate the level of change required:
Emoji | Label | Meaning |
---|---|---|
🔴 | Breaking | A breaking change which will likely require code or config changes to resolve |
🟠 | Possibly Breaking | A breaking change that is unlikely to require code changes but things outside of the code (e.g. logs) may have changed |
🔴 Breaking: this version drops support for Node.js v14. If your app is already using Node.js v16 or above then you can migrate with no code changes.
🟠 Possibly Breaking: this version switches to use Reliability Kit's logger by default. This means that logs will not be sent directly to Splunk but will be sent to stdout
. This may mean you lose some logs if you haven't configured your app to forward these logs somewhere more permanent.
You may not need to change anything for this upgrade, for example, if your app uses Heroku log drains or a Lambda log forwarder. The logger migration guide has more information.
If you can't switch to Reliability Kit logger yet, then you can still use n-logger (the previous default logger) by manually passing it as an option when initialising the middleware:
const createErrorLogger = require('@dotcom-reliability-kit/middleware-log-errors');
const nLogger = require('@financial-times/n-logger').default;
// ...
app.use(createErrorLogger({
logger: nLogger
}));
🟠 Possibly Breaking: this only impacts apps that use n-express v27 or older. Previously, this module contained code to disable the default Sentry error handling which was enabled by n-express.
You can safely migrate to this version of the error logging middleware if your app is either not using n-express or is using n-express v28 or above.
🔴 Breaking: this version drops support for Node.js v16. If your app is already using Node.js v18 or above then you can migrate with no code changes.
🔴 Breaking: this version drops support for Node.js v18. If your app is already using Node.js v20 or above then you can migrate with no code changes.