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

Language Server does not respect prisma version in monorepo #1459

Open
hrueger opened this issue Jul 12, 2023 · 4 comments
Open

Language Server does not respect prisma version in monorepo #1459

hrueger opened this issue Jul 12, 2023 · 4 comments
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. topic: validation

Comments

@hrueger
Copy link

hrueger commented Jul 12, 2023

Bug description

Hi, I just broke my production application because I trusted what the VSCode Prisma Language Server (from the official extension) suggested: I removed previewFeatures = ["filteredRelationCount"] from the generator block of the schema.prisma file.

However, it turns out that I hadn't yet updated the prisma version in the package.json files in the separate packages of my monorepo. Therefore, it is acually still needed for that (older) version of prisma.

How to reproduce

  1. Create a monorepo with the prisma folder (and the schema file) at the root and a package in /packages/app1...
  2. Install an older version of prisma there
  3. Install the official prisma vscode extension
  4. See it not respect the currently installed version of prisma in the project

Expected behavior

Maybe the Plugin / Language Server could detect the prisma version from node_modules or ask?
The current behaviour is a bit confusing ;-)

Prisma information

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["filteredRelationCount"]
}
// some query using filteredRelationCount

Environment & setup

  • OS: Windows 10
  • Database: n/a
  • Node.js version: 18.10.0

Prisma Version

Environment variables loaded from .env
prisma                  : 4.15.0
@prisma/client          : 4.15.0
Current platform        : windows
Query Engine (Node-API) : libquery-engine 8fbc245156db7124f997f4cecdd8d1219e360944 (at node_modules\@prisma\engines\query_engine-windows.dll.node)    
Migration Engine        : migration-engine-cli 8fbc245156db7124f997f4cecdd8d1219e360944 (at node_modules\@prisma\engines\migration-engine-windows.exe)
Format Wasm             : @prisma/prisma-fmt-wasm 4.15.0-28.8fbc245156db7124f997f4cecdd8d1219e360944
Default Engines Hash    : 8fbc245156db7124f997f4cecdd8d1219e360944
Studio                  : 0.484.0
Preview Features        : filteredRelationCount
┌─────────────────────────────────────────────────────────┐
│  Update available 4.15.0 -> 5.0.0                       │
│                                                         │
│  This is a major update - please follow the guide at    │
│  https://pris.ly/d/major-version-upgrade                │
│                                                         │
│  Run the following to update                            │
│    npm i --save-dev prisma@latest                       │
│    npm i @prisma/client@latest                          │
└─────────────────────────────────────────────────────────┘
@hrueger hrueger added the kind/bug A reported bug. label Jul 12, 2023
@janpio janpio transferred this issue from prisma/prisma Jul 12, 2023
@janpio
Copy link
Contributor

janpio commented Jul 12, 2023

Our VSCode extension currently unfortunately does not react to the version of your project, but is fully controlled by the version of the extension you have installed in VS Code.

This is a related issue: #66 (prisma-fmt is what is responsible for a lot of the logic, but might not actually cover the problem you encountered - not 100% sure)

@Jolg42
Copy link
Contributor

Jolg42 commented Jul 12, 2023

@hrueger What you can do for now is to select the version in VS Code UI, see screenshots:
Screenshot 2023-07-12 at 19 21 42
Screenshot 2023-07-12 at 19 21 57
In extensions, select "Prisma", then "Install Another Version...", select your Prisma version.

@Jolg42 Jolg42 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: validation domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. labels Jul 12, 2023
@hrueger
Copy link
Author

hrueger commented Jul 13, 2023

Thanks for the tip. It's not a very important issue for me, I'll update to prisma 5 very soon anyway. However, I thought I'd just open that issue here, because I was very confused at first.
Maybe we can just leave that open?

@Jolg42
Copy link
Contributor

Jolg42 commented Jul 13, 2023

Good news :)
Sure, I also think it's worth keeping this open, you're probably not the only person who could benefit from an improvement here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. topic: validation
Projects
None yet
Development

No branches or pull requests

3 participants