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

Editing schema.prisma results in wasm panics #1473

Closed
waxidiotic opened this issue Jul 25, 2023 · 3 comments · Fixed by prisma/prisma-engines#4089
Closed

Editing schema.prisma results in wasm panics #1473

waxidiotic opened this issue Jul 25, 2023 · 3 comments · Fixed by prisma/prisma-engines#4089
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: code action topic: language server topic: wasm
Milestone

Comments

@waxidiotic
Copy link

Bug description

Any input inside of myschema.prisma file results in an error toast being displayed within VS Code.

Error:

prisma-schema-wasm errored. To get a more detailed output please see Prisma Language Server output.
You can do this by going to View, then Output from the toolbar, and then select 'Prisma Language Server' in the drop-down menu.

Output of just typing the word "test" in my schema was 1720 lines long so I included it in this gist.

How to reproduce

  1. Open schema.prisma
  2. Type any input

Expected behavior

Input will be added to schema without error.

Prisma information

My schema can be found here: https://github.com/waxidiotic/show-grind/blob/main/prisma/schema.prisma

Environment & setup

  • OS: macOS
  • Editor: VS Code
  • Editor version: 1.80.1
  • Extension version: 5.0.63
@janpio janpio added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug. labels Jul 25, 2023
@Jolg42
Copy link
Member

Jolg42 commented Jul 26, 2023

I could reproduce and got (I used a local build with #1474)

prisma-schema-wasm errored (panic) with: prisma-schema-wasm errored when invoking code_actions. It resulted in a Wasm panic.
RuntimeError: panicked at 'no entry found for key', psl/parser-database/src/walkers/model.rs:260:14

RuntimeError: panicked at 'no entry found for key', psl/parser-database/src/walkers/model.rs:260:14
    at rust_panic (wasm://wasm/0094251e:wasm-function[2651]:0x17491c)
    at std::panicking::rust_panic_with_hook::h5cee2a9564faeb6d (wasm://wasm/0094251e:wasm-function[1010]:0x147b70)
    at std::panicking::begin_panic_handler::{{closure}}::h38a949ca54e64e6b (wasm://wasm/0094251e:wasm-function[1483]:0x160889)
    at std::sys_common::backtrace::__rust_end_short_backtrace::hc4f3d2fd3090193f (wasm://wasm/0094251e:wasm-function[2594]:0x174760)
    at rust_begin_unwind (wasm://wasm/0094251e:wasm-function[2100]:0x16ff48)
    at core::panicking::panic_fmt::h8a19fa1eb63fbb67 (wasm://wasm/0094251e:wasm-function[2148]:0x170b25)
    at core::option::expect_failed::hd65acbc4e2342087 (wasm://wasm/0094251e:wasm-function[1811]:0x16a4d2)
    at parser_database::walkers::model::<impl parser_database::walkers::Walker<schema_ast::ast::ModelId>>::attributes::ha695952ef445ad30 (wasm://wasm/0094251e:wasm-function[1060]:0x14b139)
    at parser_database::walkers::model::<impl parser_database::walkers::Walker<schema_ast::ast::ModelId>>::schema::hffebfea9480b1b7f (wasm://wasm/0094251e:wasm-function[1558]:0x163315)
    at prisma_fmt::code_actions::h6822d2219700de56 (wasm://wasm/0094251e:wasm-function[8]:0x32a06)
[Trace - 13:30:57] Received request 'window/showMessageRequest - (24)'.
Params: {
    "type": 1,
    "message": "prisma-schema-wasm errored with: -- prisma-schema-wasm errored when invoking code_actions. It resulted in a Wasm panic.\nRuntimeError: panicked at 'no entry found for key', psl/parser-database/src/walkers/model.rs:260:14 -- For the full output check the \"Prisma Language Server\" output. In the menu, click View, then Output and select 'Prisma Language Server' in the drop-down menu.",
    "actions": []
}

Here is a minimal schema for reproduction (multiSchema is needed)

generator client {
    provider        = "prisma-client-js"
    previewFeatures = ["multiSchema"]
}

datasource db {
    provider = "postgresql"
    url      = env("DATABASE_URL")
    schemas  = ["auth"]
}

model users {
    id String @id

    @@schema("auth")
}

@Jolg42 Jolg42 added bug/2-confirmed Bug has been reproduced and confirmed. topic: language server topic: wasm topic: code action tech/engines Issue for tech Engines. team/schema Issue for team Schema. and removed bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. labels Jul 26, 2023
@Jolg42
Copy link
Member

Jolg42 commented Jul 26, 2023

Note: The same error message happens in #1466, but the stack trace is different

@aqrln aqrln self-assigned this Jul 28, 2023
@aqrln
Copy link
Member

aqrln commented Jul 28, 2023

Minimal repro:

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["multiSchema"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
  schemas  = ["auth", "public"]
}

model A {
  id   Int @id
  test
}

This was also fixed by prisma/prisma-engines#4087, I'll add a regression test.

aqrln added a commit to prisma/prisma-engines that referenced this issue Jul 28, 2023
prisma/language-tools#1473 was also fixed by
#4087, this PR adds a
regression test for that issue as well.

Closes: prisma/language-tools#1473
@janpio janpio added this to the 5.1.0 milestone Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: code action topic: language server topic: wasm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants