keystonejs / create-keystone-app

CLI app that makes it easy to get started with Keystone
https://keystonejs.com/tutorials/getting-started-with-create-keystone-next-app
MIT License
38 stars 10 forks source link

allowAccess produces errors #367

Closed alex-frx closed 1 year ago

alex-frx commented 1 year ago

See old issue

yarn create keystone-app still produces this issue. The versions in the package.json are outdated. I bumped the version up by hand now the import error is gone but i get TypeError: Cannot read properties of undefined (reading 'QUERY')

I tried using it like this:

const lists = {
  User: list({
    ui: {
      ...hide,
    },

    fields: {
      name: text({ validation: { isRequired: true } }),
      email: text({ validation: { isRequired: true }, isIndexed: "unique" }),
      posts: relationship({ ref: "Post.author", many: true }),
      password: password({ validation: { isRequired: true } }),
      isAdmin: checkbox({
        defaultValue: false,
      }),
    },
    access: allowAll
  })

Full error trace:

TypeError: Cannot read properties of undefined (reading 'QUERY')
    at Object.executeGraphQLFieldToRootVal (/Users/sandi/codespace/keystone3/node_modules/@keystone-6/core/dist/types-for-lists-d7028ceb.cjs.dev.js:389:44)
    at f (/Users/sandi/codespace/keystone3/node_modules/@keystone-6/core/dist/createSystem-5796fcbd.cjs.dev.js:1984:26)
    at getDbAPIFactory (/Users/sandi/codespace/keystone3/node_modules/@keystone-6/core/dist/createSystem-5796fcbd.cjs.dev.js:1988:14)
    at makeCreateContext (/Users/sandi/codespace/keystone3/node_modules/@keystone-6/core/dist/createSystem-5796fcbd.cjs.dev.js:2072:37)
    at getKeystone (/Users/sandi/codespace/keystone3/node_modules/@keystone-6/core/dist/createSystem-5796fcbd.cjs.dev.js:2255:29)
    at setupInitialKeystone (/Users/sandi/codespace/keystone3/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js:842:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async initKeystone (/Users/sandi/codespace/keystone3/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js:601:35)
error Command failed with exit code 1.
flexdinesh commented 1 year ago

create-keystone-app@8.0.0 released with compat changes for latest Keystone major.

You shouldn't see this error anymore.