Prisma 1 Forum

Prisma2 Nexus -> ERROR: No subset types are available

I’m trying to use the prisma2 nexus plugin.

I created a simple User model

model User {
  id            String   @default(cuid()) @id @unique
  email         String   @unique
  username      String   @unique

I created an objectType

const User = objectType({
  name: "User",
  description: "TODO",
  definition(t) {;;

But when I create my Query

const Query = objectType({
  name: "Query",
  definition(t) {

I’m getting this Error from VSCODE

(property) findOneUser: (opts: {
alias?: string | undefined;
} & {
type: "ERROR: No subset types are available. Please make sure that one of your GraphQL type is a subset of your t.model('<ModelName>')";
}) => NexusPrismaFields<...>

Expected 1 arguments, but got 0.ts(2554)

index.d.ts(129, 7): An argument for 'opts' was not provided.

If I run the program I get

Error: Type User must define one or more fields.
    at assertValidSchema (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/graphql/type/validate.js:71:11)
    at assertValidExecutionArguments (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/graphql/execution/execute.js:163:35)
    at executeImpl (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/graphql/execution/execute.js:84:3)
    at Object.execute (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/graphql/execution/execute.js:62:63)
    at Object.generateSchemaHash (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/apollo-server-core/src/utils/schemaHash.ts:11:18)
    at new ApolloServerBase (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/apollo-server-core/src/ApolloServer.ts:326:23)
    at new ApolloServer (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/apollo-server-express/src/ApolloServer.ts:84:5)
    at new ApolloServer (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/node_modules/apollo-server/src/index.ts:36:5)
    at Object.<anonymous> (/Users/remivillien/Git/RemiKalbe/dwoom-account-id/src/index.ts:67:16)
    at Module._compile (internal/modules/cjs/loader.js:777:30)
[ERROR] 12:04:35 Error: Type User must define one or more fields.

I did prisma2 generate before, is it normal that the generated schema.graphql look like that:

### This file was autogenerated by GraphQL Nexus

### Do not make changes to this file directly


scalar DateTime

type Query {

ok: Boolean!



type User

What is opts ? I looked at an example from prisma2 but I don’t see anywhere that they set some opts argument.

I solved it by setting my database to default = true

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.