Commit fa992bd
authored
fix(nextjs): Stop injecting sentry into API middleware (#4517)
During the build of a nextjs app, our SDK injects the user's `sentry.server.config.js` (which contains the call to `Sentry.init()`) into all API routes, so that `withSentry` will work. That said, we don't yet support nextjs middleware[1], so we shouldn't be injecting the file into middleware pages, even if they're in the `api/` folder.
This prevents that by adding another condition to `shouldAddSentryToEntryPoint`.
Note: This came up as part of the issue referenced below, and it does fix it, but only in a temporary way. The underlying issue is (I believe) something outside of sentry. I've encouraged the user to debug it, so that when we start supporting middleware (and therefore remove this filter), he doesn't run into problems again. See this comment: #4507 (comment).
Fixes #4507.
[1] https://nextjs.org/docs/middleware1 parent 52520ba commit fa992bd
2 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
448 | 449 | | |
449 | 450 | | |
450 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
451 | 467 | | |
452 | 468 | | |
453 | 469 | | |
| |||
0 commit comments