hi, ,anyone encountering "Field does not exist on ...
# prisma-client
j
hi, ,anyone encountering "Field does not exist on enclosing type" even if the field exists?
i double checked the db exists , and my schema does indicate it. and ive already run prisma generate. visual code does not throw space id error
r
Could you share your query and schema?
j
Copy code
model CompanySpaces {
  id         Int       @id(map: "companyspaces_pk") @default(autoincrement())
  company_id Int
  space_id   Int
  createdAt  DateTime? @db.Timetz(6)
  updatedAt  DateTime? @db.Timetz(6)
  Companies  Companies @relation(fields: [company_id], references: [id], onDelete: Cascade, map: "companyspaces_fk_company")
  Spaces     Spaces    @relation(fields: [space_id], references: [id], onDelete: Cascade, map: "companyspaces_fk_space")

  @@index([company_id], map: "companyspaces_company_id_idx")
  @@index([space_id], map: "companyspaces_space_id_idx")
}
Copy code
prisma.companyLicenses.findMany({ select: {
      company_id: true,
      space_id: true,
      private_member_size: true,
    }, where: { company_id: rec.company_id } }).then((lics) => {
      recruiter[i].licenses = lics;
    });
when space_id is passed in or include: { Spaces: true } is specified, i willl get that error
using postgresql
i debugged it down to graphql error:
Copy code
{
  error: 'Error in query graph construction: QueryParserError(QueryParserError { path: QueryPath { segments: ["Query", "findManyCompanyLicenses", "CompanyLicenses", "space_id"] }, error_kind: FieldNotFoundError })',
  user_facing_error: {
    is_panic: false,
    message: 'Failed to validate the query: `Field does not exist on enclosing type.` at `Query.findManyCompanyLicenses.CompanyLicenses.space_id`',
    meta: {
      query_validation_error: 'Field does not exist on enclosing type.',
      query_position: 'Query.findManyCompanyLicenses.CompanyLicenses.space_id'
    },
    error_code: 'P2009'
  }
}
why did we have graphql behind the scene on the prisma sdk?
fixed, ive to remove node_modules n reinstall
💯 1
r
Is your prisma and @prisma/cli version the same?
j
yes
3.1.1 i think
r
In that case, could you share a sample repo with this issue so that I can check?
j
im surprised that the sdk of prisma is calling graphql server
already fixed sorry didnt have time to filter out the private files, i suspect some node modules is probably not updated
oh ya also possible i was trying out pnpm
r
im surprised that the sdk of prisma is calling graphql server
We use that implementation internally. Possibly related to this then.