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

Message: Request textDocument/definition failed with message: Schema parsing #144

Closed
janpio opened this issue May 18, 2020 · 6 comments
Closed
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug.
Milestone

Comments

@janpio
Copy link
Member

janpio commented May 18, 2020

[Info  - 15:50:38] Installed version of Prisma binary `prisma-fmt`: 0c2ec197653b278b2978845ef958db88824cd82e
[Error - 17:48:15] Request textDocument/definition failed.
  Message: Request textDocument/definition failed with message: Schema parsing
�[1;91merror�[0m: �[1mError validating source `postgresql`: The URL for datasource `postgresql` must start with the protocol `postgresql://`.�[0m
  �[1;94m-->�[0m  �[4mschema.prisma:3�[0m
�[1;94m   | �[0m
�[1;94m 2 | �[0m  provider = "postgresql"
�[1;94m 3 | �[0m  url      = �[1;91m"foo"�[0m
�[1;94m   | �[0m

Validation Error Count: 1
  Code: -32603 

Model:

datasource postgresql {
  provider = "postgresql"
  url      = "foo"
}

generator client {
  provider = "prisma-client-js"
}

model User {
  id      Int     @default(autoincrement()) @id
  email   String  @unique
  name    String?
  role    String?
  storeId Int?
}

model Product {
  id          Int     @default(autoincrement()) @id
  handle      String  @unique
  name        String?
  description String?
  price       Int?
}

Happened when I replaced the invalid foo with postgresql://foo and a real connection string.

@carmenberndt
Copy link
Contributor

I can not reproduce this. Does this also happen when you use this connection string: url = "postgresql://johndoe:mypassword@localhost:5432/mydb?schema=public"?

@carmenberndt carmenberndt added the bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. label May 22, 2020
@janpio
Copy link
Member Author

janpio commented May 22, 2020

No.

I can reproduce this when I paste the schema above, then select foo in the editor and paste postgresql://foo over it after trying a few times.

@carmenberndt
Copy link
Contributor

carmenberndt commented May 25, 2020

I can reproduce this, but not exactly how you are describing this. When using your model with foo and then clicking Go to Definition on any value, this error occurs. This is expected though, since formatting is only possible on valid input files.

@janpio janpio added the kind/bug A reported bug. label May 25, 2020
@janpio
Copy link
Member Author

janpio commented May 25, 2020

I could now even reproduce it when I had this schema:

datasource postgresql {
  provider = "postgresql"
  url      = "foo"
}

// postgresql://foo

generator client {
  provider = "prisma-client-js"
}

model User {
  id      Int     @default(autoincrement()) @id
  email   String  @unique
  name    String?
  role    String?
  storeId Int?
}

model Product {
  id          Int     @default(autoincrement()) @id
  handle      String  @unique
  name        String?
  description String?
  price       Int?
}

When selecting and dragging on postgresql://foo to copy/paste it, the error triggered.

This is expected though, since formatting is only possible on valid input files.

Shouldn't this always be just a red squiggly underline instead of a toast and a nasty message in the output?

@carmenberndt
Copy link
Contributor

carmenberndt commented May 26, 2020

This will be fixed by #129 because textDocument/Definition does not parse the schema anymore using the sdk.

@janpio
Copy link
Member Author

janpio commented May 26, 2020

I could indeed not reproduce this with dev 0.0.1250 any more 🚀

@janpio janpio closed this as completed May 26, 2020
@janpio janpio modified the milestones: Beta 6, Beta 7 May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

2 participants