Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when used as a next swc plugin #170

Closed
stschroeder opened this issue Aug 12, 2022 · 1 comment
Closed

Error when used as a next swc plugin #170

stschroeder opened this issue Aug 12, 2022 · 1 comment

Comments

@stschroeder
Copy link

I am using swc-plugin-coverage-instrument (0.0.8) to instrumentalize my Next.js app (12.2.5). I am using the following next.config.js configuration:

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  experimental: {
    swcPlugins: [
        ['swc-plugin-coverage-instrument', {}]
    ]
  }
}

When I execute next build I get the following error:


$ RUST_BACKTRACE=1 npm run build

> swc-coverage-instrument-error@0.1.0 build
> next build

warn  - You have enabled experimental feature (swcPlugins) in next.config.js.
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
info  - Linting and checking validity of types
info  - Creating an optimized production build ..thread 'thread '<unnamed>' panicked at 'assertion failed: !bytes.is_null()', <unnamed>' panicked at 'assertion failed: !bytes.is_null()', C:\Users\kwono\.cargo\registry\src\github.com-1ecc6299db9ec823\rkyv-0.7.39\src\impls\core\mod.rs:thread '<unnamed>' panicked at 'assertion failed: !bytes.is_null()', C:\Users\kwono\.cargo\registry\src\github.com-1ecc6299db9ec823\rkyv-0.7.39\src\impls\core\mod.rs:364:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
364:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
C:\Users\kwono\.cargo\registry\src\github.com-1ecc6299db9ec823\rkyv-0.7.39\src\impls\core\mod.rs:364:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("<absPath>/swc-coverage-instrument-error/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `<absPath>/swc-coverage-instrument-error/node_modules/swc-plugin-coverage-instrument/target/wasm32-wasi/release/swc_plugin_coverage.wasm` as js transform plugin at <absPath>/swc-coverage-instrument-error/node_modules/swc-plugin-coverage-instrument/target/wasm32-wasi/release/swc_plugin_coverage.wasm
    1: RuntimeError: unreachable
    2: unreachable

Stack backtrace:
   0: _wasmer_vm_raise_trap
   1: _rust_eh_personality
   2: _napi_register_module_v1
   3: _napi_register_module_v1
   4: _napi_register_module_v1
   5: _napi_register_module_v1
   6: <unknown>
   7: <unknown>
   8: _napi_register_module_v1
   9: <unknown>
  10: _napi_register_module_v1
  11: <unknown>
  12: <unknown>
  13: _napi_register_module_v1
  14: <unknown>
  15: _worker
  16: __pthread_deallocatethread '', <unnamed>/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs' panicked at ':failed to invoke plugin: failed to invoke plugin on 'Some("<absPath>/swc-coverage-instrument-error/pages/index.js")'
...

I created a minimal example here: https://github.com/stschroeder/swc-coverage-instrument-error

You can use the following steps to reproduce the issue:

$ git clone https://github.com/stschroeder/swc-coverage-instrument-error.git
$ cd swc-coverage-instrument-error
$ npm install
$ npm run build

Please let me know if you need additional information. Thanks a lot!

@kwonoj
Copy link
Owner

kwonoj commented Aug 17, 2022

I think this is resolved with latest release + vercel/next.js#39499.

@kwonoj kwonoj closed this as completed Aug 17, 2022
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

No branches or pull requests

2 participants