magic-akari/swc_mut_cjs_exports

Crashes with thread '<unnamed>' panicked at 'failed to invoke plugin

AbhiPrasad opened this issue · 12 comments

@swc/jest causes jest to crash in CI when using the jest_workaround plugin.

GH action run: https://github.com/getsentry/sentry-javascript/actions/runs/4437301786/jobs/7787193218

PR w/ crash: getsentry/sentry-javascript#7484

SWC versions:

    "@swc/core": "1.3.40",
    "@swc/jest": "0.2.24",

jest_workaround versions:

  "jest_workaround": "0.1.16",
> @sentry/core:test

$ jest
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/runner/work/sentry-javascript/sentry-javascript/packages/core/test/lib/base.test.ts")'

Caused by:
    0: RuntimeError: out of bounds memory access
    1: heap_get_oob', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.255.3/src/plugin.rs:228:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Segmentation fault (core dumped)
error Command failed with exit code 139.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

SWC bug report: swc-project/swc#7092

swc-project/swc#7092 (comment)

I cannot checkout the code, have you deleted the branch?

pneme commented

This is not fixed. Happens to me also after upgrading to TS 5.0.

@pneme what is your exact versions for:

  • TS
  • @swc/core
  • @swc/jest
  • jest_workaround

you need to make sure that your versions all align properly.

pneme commented

@AbhiPrasad

"jest_workaround": "^0.72.6",
"@swc/core": "^1.3.44",
"@swc/jest": "^0.2.24"
"typescript": "^5.0.4"

pneme commented

@AbhiPrasad

Just updated to:
"@swc/core": "^1.3.51",
"@swc/jest": "^0.2.26",

Now I'm getting failed to invoke jest_workaround as js transform plugin at

pneme commented

@AbhiPrasad Could you send me your setup that works, please?

@pneme - I used getsentry/sentry-javascript@develop...abhi-build-swc-jest

But had to end up dropping swc because of the esm module immutability problem (couldn't do any monkey patching :/)

pneme commented

@magic-akari This MR unfortunately does not have TS 5

@AbhiPrasad I came across the same issue recently. From the discussion above, I cannot catch the workaround. Any ideas to fix it?

Hey @Lefschetz, it's been a while since I've looked at this. I recommend creating a new GH issue with a minimal reproduction so that the maintainers can take a look!

jrolfs commented

I found I had an out-of-date version of @swc/core installed, and upgrading to the latest resolved this.