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

vitest run crash: thread '<unnamed>' panicked at 'Failed to deserialize constructor options. #227

Closed
fityannugroho opened this issue Nov 15, 2023 · 1 comment · Fixed by #228
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@fityannugroho
Copy link
Owner

fityannugroho commented Nov 15, 2023

Describe the bug

Crash when run these test commands:

  • npm run test (alias for vitest run)
  • npm run test:watch (alias for vitest)

This happens often but not always. Crashes usually occur on the first try, then succeed on the next.

And since the npm run test command is used in CI workflows, those workflows are also impacted and hamper the DevOps process. The first case is found in https://github.com/fityannugroho/idn-area/actions/runs/6508997855/job/17679490953.

To Reproduce

Steps to reproduce the behavior:

  1. Clone and install this project (see the guidelines)
  2. Run npm run test or npm run test:watch
  3. See the error as shown below

Expected behavior

The command should run successfully without any errors.

Screenshots or Error logs

 ✓ src/village/village.controller.spec.ts (9) 749ms
 ✓ src/island/island.controller.spec.ts (12) 378ms
 ✓ src/district/district.controller.spec.ts (9)
 ✓ src/district/district.service.spec.ts (7)
 ✓ src/island/island.service.spec.ts (9)
 ✓ src/regency/regency.controller.spec.ts (9)
 ✓ src/regency/regency.service.spec.ts (7)
thread '<unnamed>' panicked at '
            Failed to deserialize constructor options.

            This usually happens when the javascript object passed to the constructor is missing
            properties for the ConstructorOptions fields that must have some value.

            If you set some of these in javascript trough environment variables, make sure there are
            values for data_model, log_level, and any field that is not Option<T>
            : Error { status: PendingException, reason: "", maybe_raw: 0x0, maybe_env: 0x0 }', query-engine/query-engine-node-api/src/engine.rs:166:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted

Also affects the CI workflow, for example:
https://github.com/fityannugroho/idn-area/actions/runs/6871822395/job/18689316010

Additional context

The strange thing is that there is no problem with the npm run test:cov command.

@fityannugroho fityannugroho added the bug Something isn't working label Nov 15, 2023
@fityannugroho fityannugroho added the help wanted Extra attention is needed label Nov 15, 2023
@fityannugroho
Copy link
Owner Author

fityannugroho commented Nov 15, 2023

=== From Vitest Dev Discord channel ===

Try if --pool=forks works better. Or if you are not using v1-beta, use --no-threads.

Many packages that are written in native languages don't work well when run in Nodejs workers. For example prisma also runs into similar errors.


Looks like your project is actually using prisma so you are likely running into vitest-dev/vitest#3106

From that answer, I think the problem is caused by the Prisma. So the possible solution are:

  • Upgrade the Prisma to the latest version, to see if this issue can be solved with the latest Prisma.
  • Use vitest run --no-threads.
  • Use vitest run --pool=forks with vitest v1.0.0 (still beta for now).

@fityannugroho fityannugroho linked a pull request Nov 15, 2023 that will close this issue
10 tasks
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.

1 participant