Skip to content

Conversation

@lforst
Copy link
Contributor

@lforst lforst commented Jan 23, 2023

https://github.com/getsentry/sentry-javascript/pull/6817/files#diff-5598248a0f2280565998f93876df482b2040cb761cc510b3bd2c4dfa5824dca8L103 seems to have broken the Next.js SDK multiplexer which is responsible for injecting the right SDK depending on whether the SDK is imported on browser/server/edge. It broke because it started stripping away the comment that told our loader to multiplex.

I suspected the comment was a little fragile from the beginning so let's make it a little bit more resilient by exporting a dummy const which is more or less guaranteed to be in the file to some extent. Maybe still not the optimal solution but better than the current one. The dummy export should not show up in types since the typing file we export doesn't actually point to the multiplexer files.

Oh, and we really need tests for middleware and edge routes. It was quite surprising that nothing caught this.

@lforst lforst requested a review from AbhiPrasad January 23, 2023 14:57
*/
export default function sdkMultiplexerLoader(this: LoaderThis<LoaderOptions>, userCode: string): string {
if (!userCode.includes('__SENTRY_SDK_MULTIPLEXER__')) {
if (!userCode.includes('_SENTRY_SDK_MULTIPLEXER')) {
Copy link
Member

Choose a reason for hiding this comment

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

m: let's please leave a comment explaining why this is a exported const in the doc string

@AbhiPrasad
Copy link
Member

we really need tests for middleware and edge routes

Let's make a GH issue to track?

@lforst
Copy link
Contributor Author

lforst commented Jan 23, 2023

we really need tests for middleware and edge routes

Let's make a GH issue to track?

Aye! #6906

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants