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

Issue: When using is and isNot from <Model>WhereInput inside of a some or every, Prisma throws a validation error. #102

Closed
maoosi opened this issue Jan 29, 2023 · 2 comments
Assignees
Labels
is: bug Something isn't working is: investigating Something isn't working
Milestone

Comments

@maoosi
Copy link
Owner

maoosi commented Jan 29, 2023

No description provided.

@Tenrys
Copy link
Contributor

Tenrys commented Jan 31, 2023

The same thing happens with isNull.

At the same time, a query like this will error:

query ListValuations($where: ValuationWhereInput) {
  listValuations(where: $where) {
    agent { 
      uuid
    }
    mandate {
      visits {
        appointment
      }
    }
  }
}
{
  "where": {
    "AND": [
      {
        "agent": {
          "uuid": {
            "equals": "f7607a26-e124-4ece-9b5a-300644d453bb"
          }
        },
        "mandate": {
          "visits": {
            "some": {
              "appointment": {
                "isNull": true
              }
            }
          }
        }
      }
    ]
  }
}

Like so:

{
  "errors": [
    {
      "message": "Invalid query: where,AND,[object Object],agent,uuid,equals,mandate,visits,some,appointment\nInvalid token: [object Object]\nIt must be one of the following:\n - a property name string\n - an array index integer, positive or negative\n - a property name regular expression\n - { type: \"any\" }\n - { type: \"slice\", from: integer, to: integer }",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ]
}

It seems to be an error from wild-wild-path's set function, because https://github.com/Tenrys/prisma-appsync/blob/ea7d8adff27ad9776adae8a980e8df48ec257367/packages/client/src/utils.ts#L201 returns the whole array as part of the path instead of the proper index.

maoosi added a commit that referenced this issue Feb 6, 2023
@maoosi
Copy link
Owner Author

maoosi commented Feb 6, 2023

@Tenrys Thanks for the details!

I could identify 2 issues: one with the GraphQL schema (for which I have added a new <Model>WhereInputWithoutNullables in the generator template) and one with the path when using arrays like AND or OR.

Could you please give it a try using prisma-appsync@1.0.0-preview.6.8?

@maoosi maoosi moved this to Ready to release in Prisma-AppSync Roadmap Feb 6, 2023
@maoosi maoosi added this to the 1.0.0-rc.6 milestone Feb 6, 2023
@maoosi maoosi closed this as completed Feb 6, 2023
@maoosi maoosi self-assigned this Feb 7, 2023
@maoosi maoosi moved this from Ready to release to Released in Prisma-AppSync Roadmap Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug Something isn't working is: investigating Something isn't working
Projects
Status: Released
Development

No branches or pull requests

2 participants