After upgrading to 1.31 I'm getting `Cannot return...
# orm-help
j
After upgrading to 1.31 I'm getting
Cannot return null for non-nullable type
error for custom resolvers on my types. These are either relationship resolvers or custom agregation resolvers, both worked fine before. What changed that broke this?
z
Can you show the query and the resolver function?
j
I get the same error in the admin ui so actually it has nothing to do with the resolvers, but it happens when I call the relation functions with the generated client as well. It only occurs in non-list relations
z
Can you show the code?
j
Copy code
type Group {
  # a group of students attending class together
  id: ID! @id
  name: String!
  students: [Student!]!
  classSessions: [ClassSession!]!
  semester: Semester!
  createdAt: DateTime! @createdAt
  updatedAt: DateTime! @updatedAt
}
lets say that's the type I'm querying
Copy code
{
groups {
  id
  name
  students {
    id
  }
}
}
works just fine
but if I query semester, then I'm in trouble
z
What's the error?
j
Its something to do with the new datamodel, i guess
Cannot return null for non-nullable type semester
z
Show me the Semester Type
j
I think its a broader problem as I am having trouble deploying with the new version. let me sort that first
z
You have set this :
semester: Semester!
which means in a query Semester should not be null, which means you don't have a Semester connected to the group
j
type Semester { id: ID! @id startDate: DateTime! endDate: DateTime! name: String! @unique groups: [Group!]! createdAt: DateTime! @createdAt updatedAt: DateTime! @updatedAt }
z
Are you sure they are connected?
j
Yeah I get the non-nullable concept, but I think this might have to do with the database not being connected or the tables not be connected correctly.
I am not
z
When you create a Group do you connect it to a Semester?
j
yeah. like I said it was working before
I may be focused on the wrong problem let me get my sever mostly working first
Yeah my database server docker image was broken so it wasn't connecting to the database properly. I suspect that I broke the database server while trying to fix it, but that the link tables may have gotten broken when I upgraded to the new datamodel. The problem is resolved. Error msg was tripping me up
z
Oh that's cool