Error reporting with Sentry
For error logging you can set up a Sentry instance and add it as described below.
Set up a Sentry account
First you need to set up a Sentry account to get a DSN used to receive the error events. You could set up an account at Sentry.io, or use another hosted instance if you have your own.
Activating Sentry
Update your shop.config.js
to provide the Sentry DSN at the proper place. You can either hard code the values, or use env vars as in the example below:
// shop.config.js
const config = {
// rest of your config
sentry: {
clientDSN: process.env.YOUR_SENTRY_CLIENT_DSN,
serverDSN: process.env.YOUR_SENTRY_SERVER_DSN,
ignoreErrors: [],
},
};
export default config;
Then you need to set up the env vars in your local environnment, or in the Gitlab repository settings (Settings -> CI/CD -> Variables).
Ignoring errors
As you may notice, there's a lot of client side errors that is logged that you might not be interested in - such as network request failures etc. which is usually due to bad network connection on the client side.
To filter errors out, there's an option where you can supply a string or a RegExp to filter out errors. See the section about ignoreErrors
at the Sentry documentation.