Skip to content

Sentry is not working with module federation #13075

@SarathSantoshDamaraju

Description

@SarathSantoshDamaraju

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

^7.107.0

Framework Version

vue:2.6.12 (HOST APP) , vue:3.2.45 (REMOTE APP)

Link to Sentry event

No response

Reproduction Example/SDK Setup

I am unable to get sentry work with the Module federation setup following this document https://docs.sentry.io/platforms/javascript/best-practices/micro-frontends/#automatically-route-errors-to-different-projects-depending-on-module

Things to Note

  1. the setup works when tested from the local in DEV mode
  2. But then BUILT for STAGING or PRODUCTION and DEPLOYED. It is not working in those env.
  3. I have tested there are no filters or related config is passed.

Detailed Notes

  1. Our use-case is, we load vue3 apps(REMOTE Apps, with no sentry setup.) into vue2(HOST APP, with Sentry.init()) with the module federation of webpack. Which is already pushed to the prod couple of quarters back.
  2. Now, we want to set up individual "projects" for each of these REMOTE federated applications to assign the errors to the correct team using https://docs.sentry.io/platforms/javascript/best-practices/micro-frontends/. Which is a blocker (Issue -2)
  3. In the process of debugging, We have observed that, if an error logged on the HOST App, it reaches sentry. But an error logged from the REMOTE app Sentry logs are missing and we have seen no api calls from sentry for such errors. So we can assume, they are not reaching sentry in the PROD environment. (Issue -1, may be the underlying cause)
  4. This is not working even with "global" or "window" error handlers (Like window.onerror or window.addEventListener('unhandledrejection') nor "sentry.captureError" . So nothing is able to capture the error triggered on the REMOTE(federated apps) when they are deployed to Prod.

Steps to Reproduce

  1. Setup a VUE2 HOST APP
  2. Load any VUE3 remote app into it with help of module federation with webpack, by following https://docs.sentry.io/platforms/javascript/best-practices/micro-frontends/#automatically-route-errors-to-different-projects-depending-on-module
  3. Build it and push the code / run in local.
  4. try to trigger any error on the REMOTE APP and you see it wont be reaching to sentry

Expected Result

  1. As per the docs, sentry on the HOST App should redirect the errors to the right project using the DSN returned from the transporter.

Actual Result

you see no errors are reaching to sentry

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions