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

Calling dmmf raises "Schema parsing - Error while interacting with query-engine-node-api library" misleading error message when there is a schema validation error. #14588

Closed
jkomyno opened this issue Aug 1, 2022 · 2 comments · Fixed by #14512
Assignees
Labels
kind/improvement An improvement to existing feature and code. team/schema Issue for team Schema. topic: dmmf topic: dx
Milestone

Comments

@jkomyno
Copy link
Contributor

jkomyno commented Aug 1, 2022

For instance, trying to use an invalid referential action prints the following error:

Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library
    Error code: P1012
    error: Error validating: Invalid referential action: `SetDefault`. Allowed values: (`Cascade`, `Restrict`, `NoAction`, `SetNull`)

t means that calling NodeAPIQueryEngineLibrary.dmmf(datamodel) had thrown an error which was successfully JSON-parsed. This is coherent with what was happening before the getConfig/getDmmf refactoring (https://github.com/prisma/prisma/blob/3.11.0/packages/sdk/src/engine-commands/getDmmf.ts#L58-L64).

In practice, such an error doesn't necessarily imply a schema parsing issue, so we should be able to disambiguate actual "Schema Parsing" errors vs these "Invalid Request" errors.

See internal discussion here.

@jkomyno jkomyno added kind/improvement An improvement to existing feature and code. topic: dx topic: dmmf team/schema Issue for team Schema. labels Aug 1, 2022
@jkomyno jkomyno self-assigned this Aug 1, 2022
@jkomyno
Copy link
Contributor Author

jkomyno commented Aug 23, 2022

Note: Error P1012 is considered a SchemaParserError according to the Rust code.

@Jolg42
Copy link
Member

Jolg42 commented Aug 23, 2022

@jkomyno I recall that what @janpio reported in conversations on zoom which then got turned into this issue is that the following bit:
- Error while interacting with query-engine-node-api library is unexpected here.

It is indeed an error from Schema parsing but - Error while interacting with query-engine-node-api library makes us/the user think that there was an error about the communication with the query-engine-node-api library.
So here the communication with the engine works as expected and the message is misleading.

@Jolg42 Jolg42 added this to the 4.3.0 milestone Aug 23, 2022
@Jolg42 Jolg42 changed the title Calling dmmf raises "Schema Parsing" error even when the schema is successfully parsed Calling dmmf raises "Schema parsing - Error while interacting with query-engine-node-api library" misleading error message when there is a schema validation error. Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement An improvement to existing feature and code. team/schema Issue for team Schema. topic: dmmf topic: dx
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants