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

Deno panics on nextjs + next-translate app #26124

Closed
MonstraG opened this issue Oct 10, 2024 · 3 comments
Closed

Deno panics on nextjs + next-translate app #26124

MonstraG opened this issue Oct 10, 2024 · 3 comments
Assignees
Labels
bug Something isn't working correctly nextjs Issue relating to Next.js node compat panic

Comments

@MonstraG
Copy link

MonstraG commented Oct 10, 2024

Output of deno run dev with RUST_BACKTRACE="full":

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: windows x86_64
Version: 2.0.0
Args: ["C:\\Users\\monst\\.deno\\bin\\deno.exe", "run", "--ext=js", "-A", "C:\\Users\\monst\\Downloads\\next-translate-deno-crash\\node_modules\\.bin\\../next/dist/bin/next", "dev"]

thread 'main' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\deno_core-0.311.0\modules\map.rs:1201:5:
assertion `left == right` failed: Module already evaluated. Perhaps you've re-provided a module or extension that was already included in the snapshot? file:///C:/Users/monst/Downloads/next-translate-deno-crash/i18n.mjs (306)
  left: Evaluated
 right: Instantiated
stack backtrace:
   0:     0x7ff6462fa20d - node_api_get_module_file_name
   1:     0x7ff644adbee9 - node_api_get_module_file_name
   2:     0x7ff6462d7321 - node_api_get_module_file_name
   3:     0x7ff6462fe0c6 - node_api_get_module_file_name
   4:     0x7ff6462fd98a - node_api_get_module_file_name
   5:     0x7ff6462fd541 - node_api_get_module_file_name
   6:     0x7ff644939a13 - uv_close
   7:     0x7ff6462fe467 - node_api_get_module_file_name
   8:     0x7ff6462fe307 - node_api_get_module_file_name
   9:     0x7ff6462fe24f - node_api_get_module_file_name
  10:     0x7ff6462fe238 - node_api_get_module_file_name
  11:     0x7ff647e36dc4 - tree_sitter_javascript
  12:     0x7ff647e370f5 - tree_sitter_javascript
  13:     0x7ff647e3f8c5 - tree_sitter_javascript
  14:     0x7ff644c9cd6e - node_api_get_module_file_name
  15:     0x7ff644d01370 - node_api_get_module_file_name
  16:     0x7ff647a3f9c6 - CrashForExceptionInNonABICompliantCodeRange
  17:     0x7ff647a3db9e - CrashForExceptionInNonABICompliantCodeRange
  18:     0x7ff647a3db9e - CrashForExceptionInNonABICompliantCodeRange
  19:     0x7ff5c7c45f37 - <unknown>
  20:     0x7ff5c7c884a4 - <unknown>
  21:     0x7ff5c7c844dc - <unknown>
  22:     0x7ff5c7c8999b - <unknown>
  23:     0x7ff5c7c84695 - <unknown>
  24:     0x7ff647a3db9e - CrashForExceptionInNonABICompliantCodeRange
  25:     0x7ff647a3db9e - CrashForExceptionInNonABICompliantCodeRange
  26:     0x7ff647a81b8d - CrashForExceptionInNonABICompliantCodeRange
  27:     0x7ff647a3b71c - CrashForExceptionInNonABICompliantCodeRange
  28:     0x7ff647a3b26f - CrashForExceptionInNonABICompliantCodeRange
  29:     0x7ff646809a28 - node_api_get_module_file_name
  30:     0x7ff64680a605 - node_api_get_module_file_name
  31:     0x7ff64680a763 - node_api_get_module_file_name
  32:     0x7ff646811d81 - node_api_get_module_file_name
  33:     0x7ff6468114da - node_api_get_module_file_name
  34:     0x7ff646810f4f - node_api_get_module_file_name
  35:     0x7ff64680b18c - node_api_get_module_file_name
  36:     0x7ff646692e9d - node_api_get_module_file_name
  37:     0x7ff64667ef80 - node_api_get_module_file_name
  38:     0x7ff644d48627 - node_api_get_module_file_name
  39:     0x7ff644d46daf - node_api_get_module_file_name
  40:     0x7ff64458b898 - uv_mutex_destroy
  41:     0x7ff6441ecb28 - uv_mutex_destroy
  42:     0x7ff6449050d2 - uv_close
  43:     0x7ff6448a867c - uv_close
  44:     0x7ff644923aa4 - uv_close
  45:     0x7ff6442e5e0d - uv_mutex_destroy
  46:     0x7ff644a067b5 - node_api_get_module_file_name
  47:     0x7ff6444398df - uv_mutex_destroy
  48:     0x7ff64493c07c - uv_close
  49:     0x7ff6442b221f - uv_mutex_destroy
  50:     0x7ff644a06896 - node_api_get_module_file_name
  51:     0x7ff647dd8c8c - tree_sitter_javascript
  52:     0x7ffaef8d257d - BaseThreadInitThunk
  53:     0x7ffaf078af28 - RtlUserThreadStart

Reproduction repository: https://github.com/MonstraG/next-translate-deno-crash

The important piece of the reproduction is that i18n is being imported from a different file in next.config.mjs:

import i18n from "./i18n.mjs";
import nextTranslate from "next-translate-plugin";

/** @type {import("next").NextConfig} */
const config = {
  reactStrictMode: true,
  i18n
};

export default nextTranslate(config);

Moving it to be the next.config.mjs fixes the crash (but then the translations do not work)

Removing nextTranslate() wrap around config also fixes the crash (but then the translations do not work)

It seems that next-translate (or next-translate-plugin) is separately trying to find the i18n file.

@MonstraG MonstraG changed the title Deno crashes on .mjs file being used inside of next.config.mjs export Deno crashes on .mjs file being used inside of next.config.mjs export + next-translate Oct 10, 2024
@marvinhagemeister marvinhagemeister added bug Something isn't working correctly node compat labels Oct 10, 2024
@MonstraG
Copy link
Author

MonstraG commented Oct 10, 2024

I may have found another issue, and it might be completely unrelated.

If in the repro, the next.config.mjs is replaced with this:

const config = {
};

export default config;

(So, a completely empty config)

Then, build fails with:

PS C:\Users\monst\Downloads\next-translate-deno-crash> pnpm run build

> [email protected] build C:\Users\monst\Downloads\next-translate-deno-crash
> next build

Ignoring signal "SIGABRT" on Windows
Ignoring signal "SIGALRM" on Windows
Ignoring signal "SIGHUP" on Windows
 ▲ Next.js 14.2.15

  Creating an optimized production build ...
Ignoring signal "SIGABRT" on Windows
Ignoring signal "SIGALRM" on Windows
Ignoring signal "SIGHUP" on Windows
Failed to compile.

Error: The file or directory is not a reparse point. (os error 4390): readlink 'C:\Users\monst\Downloads\next-translate-deno-crash\node_modules\.deno\[email protected]\node_modules\next\dist\pages\_app.js'


> Build failed because of webpack errors
 ELIFECYCLE  Command failed with exit code 1.

Okay, somebody filed the second one separately: #26179

@marvinhagemeister marvinhagemeister added the nextjs Issue relating to Next.js label Oct 11, 2024
@MonstraG MonstraG changed the title Deno crashes on .mjs file being used inside of next.config.mjs export + next-translate Deno panics on nextjs + next-translate app Oct 14, 2024
devsnek added a commit to denoland/deno_core that referenced this issue Oct 18, 2024
Handle all the various states a module could be in when running
`op_import_sync`.

Refs: denoland/deno#26124
@bartlomieju bartlomieju self-assigned this Oct 22, 2024
@MonstraG
Copy link
Author

MonstraG commented Oct 25, 2024

I've tried it on 2.0.3, and the crash changed a bit:

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 2.0.3
Args: ["/home/arseny/.deno/bin/deno", "run", "--ext=js", "-A", "/home/arseny/WebstormProjects/next-translate-deno-crash/node_modules/.deno/[email protected]/node_modules/next/dist/bin/next", "build"]

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_core-0.314.2/modules/map.rs:1201:5:
assertion `left == right` failed: Module already evaluated. Perhaps you've re-provided a module or extension that was already included in the snapshot? file:///home/arseny/WebstormProjects/next-translate-deno-crash/i18n.mjs (307)
  left: Evaluated
 right: Instantiated
stack backtrace:
   0:     0x55d299e3ca75 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h1b9dad2a88e955ff
   1:     0x55d299e6e3db - core::fmt::write::h4b5a1270214bc4a7
   2:     0x55d299e36d2f - std::io::Write::write_fmt::hd04af345a50c312d
   3:     0x55d299e3e291 - std::panicking::default_hook::{{closure}}::h96ab15e9936be7ed
   4:     0x55d299e3df6c - std::panicking::default_hook::h3cacb9c27561ad33
   5:     0x55d29a4914c7 - deno::setup_panic_hook::{{closure}}::h66f3428cb237dfc4
   6:     0x55d299e3eb9f - std::panicking::rust_panic_with_hook::hfe205f6954b2c97b
   7:     0x55d299e3e7c7 - std::panicking::begin_panic_handler::{{closure}}::h6cb44b3a50f28c44
   8:     0x55d299e3cf39 - std::sys::backtrace::__rust_end_short_backtrace::hf1c1f2a92799bb0e
   9:     0x55d299e3e454 - rust_begin_unwind
  10:     0x55d299e6b313 - core::panicking::panic_fmt::h3d8fc78294164da7
  11:     0x55d299e6b76f - core::panicking::assert_failed_inner::h19a8ffbd06abbe27
  12:     0x55d29c0081c1 - core::panicking::assert_failed::h0f4e9aeabda9b17e
  13:     0x55d29c0496d8 - deno_core::modules::map::ModuleMap::mod_evaluate_sync::h0a3da4240cb42720
  14:     0x55d29c09e831 - deno_core::ops_builtin::op_import_sync::op_import_sync::v8_fn_ptr::h71f936f3ff3c6eba
  15:     0x55d299c38146 - Builtins_CallApiCallbackGeneric

(also previously that was windows, now it's linux because I decided to nuke my windows install)

@MonstraG
Copy link
Author

I've tried it on 2.0.6 and the build goes trough now, so the issue was solved somewhere in (2.0.3-2.0.6]!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly nextjs Issue relating to Next.js node compat panic
Projects
None yet
Development

No branches or pull requests

4 participants