Commit 63eab8e
committed
fix(nextjs): Execute logger.commit() on every middleware invocation
We are using the `withLogger` wrapper to handle the logger.commit on
every time the wrapped function is executed.
In `clerkMiddleware` we are wrapping the whole function with the
`withLogger` instead of the returned nextMiddleware that is executed
in every request causing the `logger.commit()` to be executed once
during the initialization of the `clerkMiddleware()` (on 1st request).
To make debug logs working for `clerkMiddleware` on every request we
need to move the `withLogger` to wrap the returned middleware instead.
In `authMiddleware` we are wrapping the returned nextMiddleware which
makes the debugging logs works without any change.1 parent a838cae commit 63eab8e
File tree
2 files changed
+41
-28
lines changed- packages/nextjs/src/server
- __tests__
2 files changed
+41
-28
lines changedLines changed: 34 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | | - | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| |||
168 | 173 | | |
169 | 174 | | |
170 | 175 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | 176 | | |
190 | 177 | | |
191 | 178 | | |
| |||
203 | 190 | | |
204 | 191 | | |
205 | 192 | | |
206 | | - | |
| 193 | + | |
207 | 194 | | |
208 | 195 | | |
209 | 196 | | |
| |||
567 | 554 | | |
568 | 555 | | |
569 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
570 | 583 | | |
571 | 584 | | |
572 | 585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | 79 | | |
83 | 80 | | |
84 | 81 | | |
| |||
104 | 101 | | |
105 | 102 | | |
106 | 103 | | |
107 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
0 commit comments