GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Parsing Issue with moduleMetadataIntegration in Next.js Micro Frontend Setup Using Sentry · Issue #12704 · getsentry/sentry-javascript Closed DescriptionIs there an existing issue for this?
How do you use Sentry?Self-hosted/on-premise Which SDK are you using?@sentry/nextjs SDK Version8.13.0 Framework VersionNext 12.3.4 @module-federation/nextjs-mf 6.7.1 Link to Sentry eventNo response SDK Setup/Reproduction Examplein remote nextjs app next.config.jsconst config = { webpack: config => { config.plugins.push( sentryWebpackPlugin({ telemetry: false, moduleMetadata: ({ release }) => ({ dsn: NEXT_PUBLIC_SENTRY_DSN, release }) }) ) } } const sentryWebpackPluginOptions = { release: '' } module.exports = withSentryConfig(config, sentryWebpackPluginOptions ) in host nextjs app sentry.client.config.jsimport { init, makeFetchTransport, moduleMetadataIntegration, makeMultiplexedTransport, } from "@sentry/browser"; const EXTRA_KEY = "ROUTE_TO"; const transport = makeMultiplexedTransport(makeFetchTransport, (args) => { const event = args.getEvent(); if ( event && event.extra && EXTRA_KEY in event.extra && Array.isArray(event.extra[EXTRA_KEY]) ) { return event.extra[EXTRA_KEY]; } return []; }); init({ dsn: "__DEFAULT_DSN__", integrations: [moduleMetadataIntegration()], transport, beforeSend: (event) => { if (event?.exception?.values?.[0].stacktrace.frames) { const frames = event.exception.values[0].stacktrace.frames; // Find the last frame with module metadata containing a DSN const routeTo = frames .filter( (frame) => frame.module_metadata && frame.module_metadata.dsn, ) .map((v) => v.module_metadata) .slice(-1); // using top frame only - you may want to customize this according to your needs if (routeTo.length) { event.extra = { ...event.extra, [EXTRA_KEY]: routeTo, }; } } return event; }, }); Steps to Reproduce
Expected ResultThe Actual ResultThe error stacktrace frame filenames in the host application, including those from the remote package, start with app:/// (e.g., app:///_next/static/chunks/769.f60b4a7892c8be2e-f60b4a7892c8be2e-fed.js). This prefix causes the moduleMetadataIntegration plugin to fail in parsing the metadata, resulting in errors from the remote package not being properly forwarded or displayed in the Sentry dashboard. Here is the generated { "Error↵ at http://xxx.com/_next/static/chunks/769.f60b4a7892c8be2e-f60b4a7892c8be2e-fed.js:1:971": { "dsn": "aaa", "release": "..." } } Activity
MetadataMetadataAssigneesLabelsNo labels Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |