Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

"Cannot read properties of null (reading 'useCallback')" on Create page

default discord avatar
c3alast year

hi! i just installed payload using create-payload-app in a pnpm turborepo/monorepo, added a new collection:


import type { CollectionConfig } from "payload/types";

export const Pages: CollectionConfig = {
  slug: "pages",
  fields: [
    {
      name: "title",
      label: "Title",
      type: "text",
      required: true,
    },
    {
      name: "body",
      label: "Body",
      type: "richText",
      required: true,
    },
  ],
};

and added it to my config file:


import path from "path";
import { webpackBundler } from "@payloadcms/bundler-webpack";
import { mongooseAdapter } from "@payloadcms/db-mongodb";
import { payloadCloud } from "@payloadcms/plugin-cloud";
import { lexicalEditor } from "@payloadcms/richtext-lexical";
import { buildConfig } from "payload/config";

import { Pages } from "./collections/Pages";
import Users from "./collections/Users";

export default buildConfig({
  admin: {
    user: Users.slug,
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    bundler: webpackBundler(),
  },
  editor: lexicalEditor({}),
  collections: [Users, Pages],
  typescript: {
    outputFile: path.resolve(__dirname, "payload-types.ts"),
  },
  graphQL: {
    schemaOutputFile: path.resolve(__dirname, "generated-schema.graphql"),
  },
  plugins: [payloadCloud()],
  db: mongooseAdapter({
    url: process.env.DATABASE_URI ?? "",
  }),
});


and when visiting

/admin/collections/pages/create

, the page goes blank and the following errors pop in the browser console:


https://gist.github.com/ceIia/6e1957f2b2e742d024729b9bb6f0ef02

I'm also using the new Lexical editor, if that helps. i have no data or no other configuration in the app so far except for that.



am i doing something wrong? i've reread the Lexical documentation multiple times, but maybe i missed something :/



turns out having

node-linker=hoisted

in

.npmrc

was the culprit.

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.