File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -22,25 +22,26 @@ This release switches the SDK to use [`AsyncLocalStorage`](https://nodejs.org/ap
22
22
If you want to manually add async context isolation to your application, you can use the new ` runWithAsyncContext ` API.
23
23
24
24
``` js
25
+ import * as Sentry from ' @sentry/node' ;
26
+
25
27
const requestHandler = (ctx , next ) => {
26
28
return new Promise ((resolve , reject ) => {
27
- Sentry .runWithAsyncContext (
28
- async hub => {
29
- hub .configureScope (scope =>
30
- scope .addEventProcessor (event =>
31
- Sentry .addRequestDataToEvent (event , ctx .request , {
32
- include: {
33
- user: false ,
34
- },
35
- })
36
- )
37
- );
38
-
39
- await next ();
40
- resolve ();
41
- },
42
- { emitters: [ctx] }
43
- );
29
+ Sentry .runWithAsyncContext (async () => {
30
+ const hub = Sentry .geCurrentHub ();
31
+
32
+ hub .configureScope (scope =>
33
+ scope .addEventProcessor (event =>
34
+ Sentry .addRequestDataToEvent (event , ctx .request , {
35
+ include: {
36
+ user: false ,
37
+ },
38
+ })
39
+ )
40
+ );
41
+
42
+ await next ();
43
+ resolve ();
44
+ });
44
45
});
45
46
};
46
47
```
You can’t perform that action at this time.
0 commit comments