graphql-nexus / nexus

Code-First, Type-Safe, GraphQL Schema Construction
https://nexusjs.org
MIT License
3.4k stars 275 forks source link

Critical dependency: the request of a dependency is an expression #1170

Open dieg092 opened 8 months ago

dieg092 commented 8 months ago

Hello, it's my first time implementing nexus in nextjs 14 project. My configuration works fine but one warning is shown when /api/graphql is requested.

This is my configuration. I dont know how to fix it. Some idea?

Warning: Screenshot 2024-03-21 at 15 07 17

Dependences: Screenshot 2024-03-21 at 15 07 40

/api/graphql/route.ts: Screenshot 2024-03-21 at 15 08 38

Schema.ts:

import {
    arg,
    enumType,
    intArg,
    interfaceType,
    makeSchema,
    objectType,
    queryType,
    stringArg,
    list,
} from 'nexus'

const Node = interfaceType({
    name: 'Node',
    definition(t) {
      t.id('id', { description: 'GUID for a resource' })
    },
    resolveType(data) {
        if (data.hasOwnProperty('username') && data.hasOwnProperty('email')) {
            return 'Account';
        }
        return null;
    }
  })

const Account = objectType({
    name: 'Account',
    definition(t) {
        t.implements(Node) 
        t.string('username')
        t.string('email')
    },
})

const StatusEnum = enumType({
    name: 'StatusEnum',
    members: ['ACTIVE', 'DISABLED'],
})

const Query = queryType({
    definition(t) {
        t.field('account', {
            type: Account, 
            args: {
                name: stringArg(),
                status: arg({ type: 'StatusEnum' }),
            },
        })
        t.field('accountsById', {
            type: list(Account),
            args: {
                ids: list(intArg()),
            },
        })
    },
})

const schema = makeSchema({
    types: [Account, Node, Query, StatusEnum],
})

export default schema
bmaciass commented 7 months ago

hi, not really related to your question but it seems this package is not maintained anymore. Just saying in case you didn't know that :smile: