@strapi/plugin-sentry 4.0.7 → 4.1.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -29
- package/admin/src/translations/es.json +0 -1
- package/package.json +2 -2
- package/server/middlewares/sentry.js +1 -1
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ To install this plugin, you need to add an NPM dependency to your Strapi applica
|
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
17
|
# Using Yarn
|
|
18
|
-
yarn add strapi
|
|
18
|
+
yarn add @strapi/plugin-sentry
|
|
19
19
|
|
|
20
20
|
# Or using NPM
|
|
21
|
-
npm install strapi
|
|
21
|
+
npm install @strapi/plugin-sentry
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
## Configuration
|
|
@@ -37,8 +37,11 @@ npm install strapi-plugin-sentry
|
|
|
37
37
|
module.exports = ({ env }) => ({
|
|
38
38
|
// ...
|
|
39
39
|
sentry: {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
enabled: true,
|
|
41
|
+
config: {
|
|
42
|
+
dsn: env('SENTRY_DSN'),
|
|
43
|
+
sendMetadata: true,
|
|
44
|
+
},
|
|
42
45
|
},
|
|
43
46
|
// ...
|
|
44
47
|
});
|
|
@@ -97,30 +100,7 @@ const sentryInstance = strapi
|
|
|
97
100
|
|
|
98
101
|
## Disabling
|
|
99
102
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
By default, this plugin uses a middleware that logs all your unhandled API errors to Sentry. You can disable this feature by turning off the `sentry` middleware in your app's config.
|
|
103
|
-
|
|
104
|
-
**Example**
|
|
105
|
-
|
|
106
|
-
`./config/middleware.js`
|
|
107
|
-
|
|
108
|
-
```js
|
|
109
|
-
module.exports = {
|
|
110
|
-
//...
|
|
111
|
-
settings: {
|
|
112
|
-
sentry: {
|
|
113
|
-
enabled: false,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Only the middleware will be disabled. You will still have access to the Sentry service.
|
|
120
|
-
|
|
121
|
-
### Disabling the plugin entirely
|
|
122
|
-
|
|
123
|
-
You can also completely disable this plugin (both the middleware and the service). If you omit the `dsn` property of your plugin's settings, or if you give it a null value, the Sentry plugin will be ignored. You can use the `env` utility to disable it depending on the environment.
|
|
103
|
+
This plugin can be disabled in the plugins configuration file. With the `env` utility, it is also possible to disable it depending on the environment.
|
|
124
104
|
|
|
125
105
|
**Example**
|
|
126
106
|
|
|
@@ -130,7 +110,8 @@ You can also completely disable this plugin (both the middleware and the service
|
|
|
130
110
|
module.exports = ({ env }) => ({
|
|
131
111
|
// ...
|
|
132
112
|
sentry: {
|
|
133
|
-
|
|
113
|
+
// Only enable Sentry in production
|
|
114
|
+
enabled: env('NODE_ENV') === 'production',
|
|
134
115
|
},
|
|
135
116
|
// ...
|
|
136
117
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-sentry",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.1-alpha.0",
|
|
4
4
|
"description": "Send Strapi error events to Sentry",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"description": "Send Strapi error events to Sentry.",
|
|
40
40
|
"kind": "plugin"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "bedb04a0cc23719e4eac43e6005fe0fa3d48a9a6"
|
|
43
43
|
}
|
|
@@ -18,7 +18,7 @@ module.exports = ({ strapi }) => {
|
|
|
18
18
|
try {
|
|
19
19
|
await next();
|
|
20
20
|
} catch (error) {
|
|
21
|
-
|
|
21
|
+
sentryService.sendError(error, (scope, sentryInstance) => {
|
|
22
22
|
scope.addEventProcessor(event => {
|
|
23
23
|
// Parse Koa context to add error metadata
|
|
24
24
|
return sentryInstance.Handlers.parseRequest(event, ctx.request, {
|