sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

fix(remix): add esm export for node

Open topaxi opened this issue 1 year ago • 6 comments

We are running remix in ESM mode, but the exports in package.json is pointing to the CommonJS module, which results in the SDK running in CommonJS mode instead of ESM.

This lead to the instrumentations not running/detecting properly.

topaxi avatar Jun 26 '24 13:06 topaxi

Thanks for the PR @topaxi, I have tested this locally, which caused the server/client trace-propagation to break on E2E tests. I'll try to check what caused that.

onurtemizkan avatar Jun 27 '24 12:06 onurtemizkan

@topaxi, could you please check if the update here solves your issue?

onurtemizkan avatar Jun 27 '24 13:06 onurtemizkan

@onurtemizkan no, this will still run the package in CommonJS mode.

topaxi avatar Jun 28 '24 04:06 topaxi

What does work for me though, is to specify the default import. I have updated the PR :)

Sadly I'm not able to install the npm dependencies locally from this repository as yarn does not succeed and playwright install tries to call apt which I do not have on my machine.

topaxi avatar Jun 28 '24 04:06 topaxi

Thanks for the update @topaxi. Yes, I can see that specifying default under import does not break the current tests. But to validate that it works on tests, could you tell which instrumentations were not detected properly?

onurtemizkan avatar Jun 28 '24 07:06 onurtemizkan

This was specifically for express. The logs showed that express was not instrumented, and debug: true logged that sentry was running in CommonJS mode.

Switching sentry/remix to ESM fixed it (I assume previously, sentry instrumented only the CJS versions of the package(s), which aren't actually run in the application).

topaxi avatar Jun 28 '24 07:06 topaxi

Thanks for the fix @topaxi!

AbhiPrasad avatar Jul 02 '24 15:07 AbhiPrasad

This change broke our E2E tests so we'll likely revert.

lforst avatar Jul 03 '24 13:07 lforst