feat(remix): Export a manual wrapper for custom Express servers.
⚠️ Requires tests
Remix allows custom server declarations and exports createRequestHandler functions from each adapter. In some cases, createRequestHandler functions are used before we have a chance to instrument them.
Also, we wrap the core createRequestHandler from @remix/server-runtime, which all the adapters use. Each adapter may have their own APIs, so we can't directly re-export our already implemented wrapper.
This PR implements and exports a manual wrapper for Express adapters.
Also:
- Moves Remix-related type declarations to its own file, as it seems it will continue to grow.
size-limit report 📦
| Path | Size |
|---|---|
| @sentry/browser - ES5 CDN Bundle (gzipped + minified) | 19.39 KB (+0.02% 🔺) |
| @sentry/browser - ES5 CDN Bundle (minified) | 59.99 KB (0%) |
| @sentry/browser - ES6 CDN Bundle (gzipped + minified) | 17.96 KB (+0.01% 🔺) |
| @sentry/browser - ES6 CDN Bundle (minified) | 52.88 KB (0%) |
| @sentry/browser - Webpack (gzipped + minified) | 19.73 KB (0%) |
| @sentry/browser - Webpack (minified) | 64.21 KB (0%) |
| @sentry/react - Webpack (gzipped + minified) | 19.75 KB (0%) |
| @sentry/nextjs Client - Webpack (gzipped + minified) | 44.16 KB (0%) |
| @sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) | 25.79 KB (0%) |
| @sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) | 24.04 KB (+0.01% 🔺) |
If this wrapper is used when it's not needed, loader, action and documentRequest spans are reported twice. Is there a preferred way to prevent multiple wrapping
We should be able to use __sentry_wrapped__ - just set it on the wrapped function so we don't wrap multiple times. We could also just store some flags internally, and flip them the first time we wrap - then we can just check those again.
@AbhiPrasad, the updated tests do not test the manual wrapper by itself. (As I could not recreate the scenario with the current testing structure). But they are testing when we use a manual wrapper on an already instrumented backend.
@onurtemizkan That should be fine, we can also dogfood with vanguard to make sure we have added confidence.
Great timing for my company as we are currently implementing Sentry in our newest app which happens to be using Remix (wrapped by express 😄). Looking forward to the next release!
Awesome news @justinwaite - we’ll have a release out early next week!
@onurtemizkan We’ll need to add some docs, can you take care of that?