Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dieg092 opened this issue Mar 21, 2024 · 1 comment
Open

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

dieg092 opened this issue Mar 21, 2024 · 1 comment

Comments

@dieg092
Copy link

dieg092 commented Mar 21, 2024

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
Copy link

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 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants