Skip to content

Keystone 6 Admin UI throws Unhandled Runtime Error when trying to edit Post on fresh install from CLI #9765

@jhobz

Description

@jhobz

After using the CLI tool to generate a new Keystone 6 project, I went to create a post and was met with the error in the screenshot below. I was able to generate a post through the GraphQL API, but trying to edit it in the Admin UI results in the same error.

Image

package.json dependencies:

"dependencies": {
  "@keystone-6/auth": "^8.0.0",
  "@keystone-6/core": "^6.0.0",
  "@keystone-6/fields-document": "^9.0.0",
  "typescript": "^5.5.0"
},

Post part of the schema (I added one relation, but the error was happening before I added it):

  Post: list({
    // WARNING
    //   for this starter project, anyone can create, query, update and delete anything
    //   if you want to prevent random people on the internet from accessing your data,
    //   you can find out more at https://keystonejs.com/docs/guides/auth-and-access-control
    access: allowAll,

    // this is the fields for our Post list
    fields: {
      title: text({ validation: { isRequired: true } }),

      // the document field can be used for making rich editable content
      //   you can find out more at https://keystonejs.com/docs/guides/document-fields
      content: document({
        formatting: true,
        layouts: [
          [1, 1],
          [1, 1, 1],
          [2, 1],
          [1, 2],
          [1, 2, 1],
        ],
        links: true,
        dividers: true,
        // relationships: {
        //   mention: {
        //     listKey: 'Post',
        //     label: 'Mention',
        //     selection: 'id title',
        //   },
        // },
      }),

      // with this field, you can set a User as the author for a Post
      author: relationship({
        // we could have used 'User', but then the relationship would only be 1-way
        ref: 'User.posts',

        // this is some customisations for changing how this will look in the AdminUI
        ui: {
          displayMode: 'cards',
          cardFields: ['name', 'email'],
          inlineEdit: { fields: ['name', 'email'] },
          linkToItem: true,
          inlineConnect: true,
        },
        many: false,
      }),

      sport: relationship({
        ref: 'Sport.posts',
        ui: {
          displayMode: 'select',
        },
        many: false,
      }),

      // with this field, you can add some Tags to Posts
      tags: relationship({
        // we could have used 'Tag', but then the relationship would only be 1-way
        ref: 'Tag.posts',

        // a Post can have many Tags, not just one
        many: true,

        // this is some customisations for changing how this will look in the AdminUI
        ui: {
          displayMode: 'cards',
          cardFields: ['name'],
          inlineEdit: { fields: ['name'] },
          linkToItem: true,
          inlineConnect: true,
          inlineCreate: { fields: ['name'] },
        },
      }),
    },
  }),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions