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

A build error with Next.js #25

Closed
doc-sultan opened this issue Feb 23, 2023 · 13 comments · Fixed by #28
Closed

A build error with Next.js #25

doc-sultan opened this issue Feb 23, 2023 · 13 comments · Fixed by #28
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@doc-sultan
Copy link

The recent release (v0.2.1) comes with the error:

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin

Caused by:
    0: failed to invoke `.../node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /.../node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: out of bounds memory access
       at rkyv::impls::alloc::boxed::<impl rkyv::Deserialize<alloc::boxed::Box<T>,D>
@andrii-bodnar andrii-bodnar added bug Something isn't working help wanted Extra attention is needed labels Feb 23, 2023
@andrii-bodnar
Copy link
Contributor

Related - #24

@timofei-iatsenko
Copy link
Collaborator

Could you narrow the case to one file or particular line in code which cause the issue?

@andrii-bodnar
Copy link
Contributor

@doc-sultan @stovmascript, we've just released the 0.2.2 version, could you please try it?

@timofei-iatsenko
Copy link
Collaborator

Don't forget to remove 'next' folder, otherwise you may not see changes

@doc-sultan
Copy link
Author

doc-sultan commented Feb 23, 2023

The bug is still there:

ncu -u
rm -r .next node_modules
npm i
npm run dev

The error log:

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /my-project/.env
warn  - You have enabled experimental features (appDir, 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  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
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("/my-project/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: unreachable
           at rust_panic (<module>[1365]:0xe288b)
           at std::panicking::rust_panic_with_hook::h911ba172265603df (<module>[819]:0x8f4c0)
           at std::panicking::begin_panic_handler::{{closure}}::h7b07dd737a4d8757 (<module>[1372]:0xe2f89)
           at std::sys_common::backtrace::__rust_end_short_backtrace::ha54585d732ac30f6 (<module>[1371]:0xe2ebf)
           at rust_begin_unwind (<module>[749]:0x85a68)
           at core::panicking::panic_fmt::h6958314cbbe045b2 (<module>[448]:0x628a8)
           at core::result::unwrap_failed::h5a65fd54aeec1613 (<module>[33]:0x42bc)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb8c7)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: unreachable', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
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("/my-project/node_modules/next/dist/client/next-dev.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: unreachable
           at rust_panic (<module>[1365]:0xe288b)
           at std::panicking::rust_panic_with_hook::h911ba172265603df (<module>[819]:0x8f4c0)
           at std::panicking::begin_panic_handler::{{closure}}::h7b07dd737a4d8757 (<module>[1372]:0xe2f89)
           at std::sys_common::backtrace::__rust_end_short_backtrace::ha54585d732ac30f6 (<module>[1371]:0xe2ebf)
           at rust_begin_unwind (<module>[749]:0x85a68)
           at core::panicking::panic_fmt::h6958314cbbe045b2 (<module>[448]:0x628a8)
           at core::result::unwrap_failed::h5a65fd54aeec1613 (<module>[33]:0x42bc)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb8c7)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: unreachable', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/my-project/node_modules/next/dist/client/app-next-dev.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: out of bounds memory access
           at rkyv::impls::alloc::boxed::<impl rkyv::Deserialize<alloc::boxed::Box<T>,D> for rkyv::boxed::ArchivedBox<<T as rkyv::ArchiveUnsized>::Archived>>::deserialize::h4156d05ee7d17887 (<module>[504]:0x6c5e6)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb7a0)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/my-project/node_modules/next/dist/client/router.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: unreachable
           at rust_panic (<module>[1365]:0xe288b)
           at std::panicking::rust_panic_with_hook::h911ba172265603df (<module>[819]:0x8f4c0)
           at std::panicking::begin_panic_handler::{{closure}}::h7b07dd737a4d8757 (<module>[1372]:0xe2f89)
           at std::sys_common::backtrace::__rust_end_short_backtrace::ha54585d732ac30f6 (<module>[1371]:0xe2ebf)
           at rust_begin_unwind (<module>[749]:0x85a68)
           at core::panicking::panic_fmt::h6958314cbbe045b2 (<module>[448]:0x628a8)
           at core::result::unwrap_failed::h5a65fd54aeec1613 (<module>[33]:0x42bc)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb8c7)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: unreachable', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/my-project/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: out of bounds memory access
           at rkyv::impls::alloc::boxed::<impl rkyv::Deserialize<alloc::boxed::Box<T>,D> for rkyv::boxed::ArchivedBox<<T as rkyv::ArchiveUnsized>::Archived>>::deserialize::h4156d05ee7d17887 (<module>[504]:0x6c5e6)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb7a0)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/my-project/node_modules/next/dist/pages/_app.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: out of bounds memory access
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2da92)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2db26)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2db26)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2db26)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb9ff)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/my-project/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: out of bounds memory access
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb342)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
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("/my-project/node_modules/next/dist/pages/_document.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: unreachable
           at rust_panic (<module>[1365]:0xe288b)
           at std::panicking::rust_panic_with_hook::h911ba172265603df (<module>[819]:0x8f4c0)
           at std::panicking::begin_panic_handler::{{closure}}::h7b07dd737a4d8757 (<module>[1372]:0xe2f89)
           at std::sys_common::backtrace::__rust_end_short_backtrace::ha54585d732ac30f6 (<module>[1371]:0xe2ebf)
           at rust_begin_unwind (<module>[749]:0x85a68)
           at core::panicking::panic_fmt::h6958314cbbe045b2 (<module>[448]:0x628a8)
           at core::result::unwrap_failed::h5a65fd54aeec1613 (<module>[33]:0x42bc)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb8c7)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: unreachable', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/my-project/node_modules/next/dist/pages/_app.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: out of bounds memory access
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2da92)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2db26)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2db26)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h896b4914e2b65c61 (<module>[156]:0x2db26)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb9ff)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.242.2/src/plugin.rs:228:14
error - ./node_modules/next/dist/client/dev/amp-dev.js
Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/my-project/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: failed to invoke `/my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /my-project/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: unreachable
           at rust_panic (<module>[1365]:0xe288b)
           at std::panicking::rust_panic_with_hook::h911ba172265603df (<module>[819]:0x8f4c0)
           at std::panicking::begin_panic_handler::{{closure}}::h7b07dd737a4d8757 (<module>[1372]:0xe2f89)
           at std::sys_common::backtrace::__rust_end_short_backtrace::ha54585d732ac30f6 (<module>[1371]:0xe2ebf)
           at rust_begin_unwind (<module>[749]:0x85a68)
           at core::panicking::panic_fmt::h6958314cbbe045b2 (<module>[448]:0x628a8)
           at core::result::unwrap_failed::h5a65fd54aeec1613 (<module>[33]:0x42bc)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h63fbbdb1a00b4c47 (<module>[70]:0xb8c7)
           at __transform_plugin_process_impl (<module>[594]:0x7b8e2)
           at __transform_plugin_process_impl.command_export (<module>[1587]:0xfc0f2)
    2: unreachable

@timofei-iatsenko
Copy link
Collaborator

Do you update only plugin or nextjs also? I wondering what can cause such isse because stacktrace is useless.

Looks like somethong else was also updated, no only SWC plugin.

@timofei-iatsenko
Copy link
Collaborator

confirmed, was able to reproduce the bug in the ./example/nextjs-13 in this repo

@shouze
Copy link

shouze commented Feb 23, 2023

@thekip experimenting same issue, just updated the plugin.

@timofei-iatsenko
Copy link
Collaborator

Issue in SWC repo for tracking swc-project/swc#6807

@andrii-bodnar
Copy link
Contributor

@thekip thank you!

@andrii-bodnar
Copy link
Contributor

https://github.com/lingui/swc-plugin/releases/tag/0.2.3

@doc-sultan
Copy link
Author

Do you update only plugin or nextjs also? I wondering what can cause such isse because stacktrace is useless.

Looks like somethong else was also updated, no only SWC plugin.

When I put back: "@lingui/swc-plugin": "0.2.0" it works. No updates except @lingui/swc-plugin.

@timofei-iatsenko
Copy link
Collaborator

try 0.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants