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.

Code block error

default discord avatar
toolreaz2 years ago
3

Any idea why I get this error:

Collection "posts" > Field "content" > "value" does not match any of the allowed types

When adding this block to a block field in a collection:


import { Block } from "payload/types";

const CodeBlock: Block = {
  slug: "Code",
  fields: [
    {
      name: "content",
      type: "code",
      required: true,
      admin: { editorOptions: { minimap: false } },
    },
  ],
};

export default CodeBlock;
  • default discord avatar
    notchr2 years ago

    Can we check out the posts collection defenition too?

  • discord user avatar
    patrikkozak
    2 years ago

    Hey

    @150555628862046209

    - were you able to figure out what was happening here? Would love to get to the bottom of this 👍

  • default discord avatar
    toolreaz2 years ago

    Hi

    @1032341301619871785

    , it looks like it's the editorOptions which is causing the error even if its empty> Removing it solves the issue



    And btw I did a misstake in my example, it should be


    admin: { editorOptions: { minimap: { enabled: false } } },
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.