prisma / prisma-1-cloud-feedback

Feedback for Prisma Cloud
https://app.prisma.io
5 stars 4 forks source link

Search box is not working #215

Open frandiox opened 5 years ago

frandiox commented 5 years ago

Hi! Every time we use the search feature in Prisma Cloud it throws an error in the console:

GraphcoolSchema.ts:178 Uncaught (in promise) Error: {
  "message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:api:cjmuejwi31gr10950yjkgbhka",
  "path": [
    "users"
  ],
  "locations": [
    {
      "line": 2,
      "column": 3
    }
  ],
  "requestId": "local:api:cjmuejwi31gr10950yjkgbhka"
}

Deployed to Zeit Now Prisma version: 1.14 Stack trace in the server:


{"key":"error/unhandled","requestId":"local:api:cjmuejwi31gr10950yjkgbhka","clientId":"fulfillment$prod","payload":{"exception":"java.lang.RuntimeException: Not supported: ScalarFilter(ScalarField(id,com.prisma.shared.models.TypeIdentifier$Cuid$@dae6260,true,false,true,false,false,false,None,None,None,FieldTemplate(id,com.prisma.shared.models.TypeIdentifier$Cuid$@dae6260,true,false,true,false,false,false,None,None,None,None,None),com.prisma.shared.models.Model@18deedb8),Contains(CuidGCValue(cjkta0lx001gx0a85qmyr3lh4)))","query":"{\n  users(skip: 0, first: 50, where: {\n        OR: [\n          { id_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { auth0id_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { email_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { firstName_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { identity_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { lastName_contains: \"cjkta0lx001gx0a85qmyr3lh4\" }\n        ]\n      }) {\n      id\n    auth0id\n    createdAt\n    email\n    firstName\n    identity\n    lastName\n    role\n    updatedAt\n  }\n\n  usersConnection(, where: {\n        OR: [\n          { id_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { auth0id_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { email_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { firstName_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { identity_contains: \"cjkta0lx001gx0a85qmyr3lh4\" },\n          { lastName_contains: \"cjkta0lx001gx0a85qmyr3lh4\" }\n        ]\n      }) {\n    aggregate {\n      count\n    }\n  }\n}","variables":"{}","code":"0","stack_trace":"scala.sys.package$.error(package.scala:27)\\n com.prisma.api.connector.jdbc.database.SetParams$.setFilter(SetParams.scala:86)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$2(SetParams.scala:59)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$2$adapted(SetParams.scala:59)\\n scala.collection.Iterator.foreach(Iterator.scala:929)\\n scala.collection.Iterator.foreach$(Iterator.scala:929)\\n scala.collection.AbstractIterator.foreach(Iterator.scala:1417)\\n scala.collection.IterableLike.foreach(IterableLike.scala:71)\\n scala.collection.IterableLike.foreach$(IterableLike.scala:70)\\n scala.collection.AbstractIterable.foreach(Iterable.scala:54)\\n com.prisma.api.connector.jdbc.database.SetParams$.setFilter(SetParams.scala:59)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$3(SetParams.scala:60)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$3$adapted(SetParams.scala:60)\\n scala.collection.Iterator.foreach(Iterator.scala:929)\\n scala.collection.Iterator.foreach$(Iterator.scala:929)\\n scala.collection.AbstractIterator.foreach(Iterator.scala:1417)\\n scala.collection.IterableLike.foreach(IterableLike.scala:71)\\n scala.collection.IterableLike.foreach$(IterableLike.scala:70)\\n scala.collection.AbstractIterable.foreach(Iterable.scala:54)\\n com.prisma.api.connector.jdbc.database.SetParams$.setFilter(SetParams.scala:60)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$2(SetParams.scala:59)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$2$adapted(SetParams.scala:59)\\n scala.collection.Iterator.foreach(Iterator.scala:929)\\n scala.collection.Iterator.foreach$(Iterator.scala:929)\\n scala.collection.AbstractIterator.foreach(Iterator.scala:1417)\\n scala.collection.IterableLike.foreach(IterableLike.scala:71)\\n scala.collection.IterableLike.foreach$(IterableLike.scala:70)\\n scala.collection.AbstractIterable.foreach(Iterable.scala:54)\\n com.prisma.api.connector.jdbc.database.SetParams$.setFilter(SetParams.scala:59)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$1(SetParams.scala:51)\\n com.prisma.api.connector.jdbc.database.SetParams$.$anonfun$setFilter$1$adapted(SetParams.scala:50)\\n scala.Option.foreach(Option.scala:257)\\n com.prisma.api.connector.jdbc.database.SetParams$.setFilter(SetParams.scala:50)\\n com.prisma.api.connector.jdbc.dat

Two servers with similar setup throw the same errors. Any ideas?

marktani commented 5 years ago

Thanks! Can you share the the User type from your datamodel? One approach would be to upgrade your Prisma server. That might or might not fix the error.

frandiox commented 5 years ago

@marktani It happens with any model and any search value, not only ids. Even when looking for a string "true" it throws the same. It doesn't matter how many rows or how many columns there are.

In any case, the user type is like this:

type User {
  id: ID! @unique
  identity: String!
  auth0id: String! @unique
  email: String! @unique
  role: Role @default(value: "...")
  firstName: String
  lastName: String
  createdAt: DateTime!
  updatedAt: DateTime!
}
marktani commented 5 years ago

Ok, so it might be a deeplier rooted issue.

For role: Role, is it an enum? Can you share that as well? Does User not have any relations?

frandiox commented 5 years ago

It's an enum, yes:

enum Role {
  ADMIN
  SPECIALIST
  MANAGER
}

The user has no relations. As I said, this happens with any model/type. Even with one that has only ID and 4 boolean values.

marktani commented 5 years ago

Ok, I cannot reproduce this in my service. That it happens on all your types indicates an issue with your service/server. Did you already try to upgrade your server?

frandiox commented 5 years ago

@marktani If I don't remember wrong, I deployed 1.14-beta originally and then upgraded to 1.14 when it was released. Nothing else after that I think 🤔

jhalborg commented 5 years ago

Since @frandiox and I have a very similar setup (ref #219), I tested this as well. In general, search seems to work fine for me, though. I did spot one weird issue, and that was looking in the console while searching.

I searched for "name" in my Campaign model, and the console threw this error: image

In my code, CampaignWhereInput does indeed not support searching for emailsToNotify_contains:

image

Not sure if that helps, but I thought I'd mention it.

marktani commented 5 years ago

@jhalborg how does the Campaign type look like in your datamodel? More specifically, what type is the field emailsToNotify of?

gentle-noah commented 5 years ago

This is a problem we have as well. I do understand that sometimes data gets out of whack and things like that, but the data browser really should be able to manage these situations with elegance and search effectively.

jhalborg commented 5 years ago

@marktani

Sorry for the delay, here's the datamodel for Campaign:

type Campaign {
  id: ID! @unique
  version: Int!
  name: String!
  ...
  emailsToNotify: [String!]!
}
frandiox commented 5 years ago

I updated from Prisma 1.14 to 1.19 without issues and now search box works again 🎉

danielnakasato commented 5 years ago

I have the same problem as @frandiox. Tried with the last versions 1.19.0 and 1.20.1 and still have this problem. Since you could solve by updating prisma version, maybe part of the problem is related to my datamodel.