Skip to content

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Sep 22, 2022

loadModule utility which we use to acquire react-router-dom can return null when called from Express wrapper.

I suspect the main reason is that we are not monkey-patching Remix core here, like we are doing in the base implementation, the package acquisition is not guaranteed to run when (or where?) react-router-dom is available.

Tried using dynamic imports, and it worked well on https://github.com/getsentry/vanguard

Transaction Before

Transaction After

Parameterized Route Transaction

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Can we try testing on vanguard with creating posts as well?

@@ -52,6 +51,8 @@ function wrapExpressRequestHandler(
}

const url = new URL(request.url);
const pkg = await import(`${cwd()}/node_modules/react-router-dom`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we not do this package load on every request - or cache it somehow? How about putting it in line 30, where we did it previously?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried out require as a synchronous alternative to put it to line 30, and it also works. Would that make sense?
Also added a post edit route transaction ⬆️

@AbhiPrasad AbhiPrasad added the Package: remix Issues related to the Sentry Remix SDK label Sep 22, 2022
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried about using the require in different environments, but let's :shipit: for now!

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) September 22, 2022 13:40
@onurtemizkan onurtemizkan changed the title fix(remix): Use import() to get react-router-dom in Express wrapper. fix(remix): Use require() to get react-router-dom in Express wrapper. Sep 22, 2022
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.43 KB (-0.2% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.08 KB (-0.14% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.06 KB (-0.01% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 53.01 KB (-0.13% 🔽)
@sentry/browser - Webpack (gzipped + minified) 19.82 KB (-0.2% 🔽)
@sentry/browser - Webpack (minified) 64.37 KB (-0.18% 🔽)
@sentry/react - Webpack (gzipped + minified) 19.84 KB (-0.2% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 44.74 KB (+0.07% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.88 KB (-0.13% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.31 KB (+0.03% 🔺)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: remix Issues related to the Sentry Remix SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants