Search code examples
sanity

Sanity.io - Unknown field found: Encountered a field that is not defined in the schema


I'm trying to get external links working via Sanity studio, following the guide here https://www.sanity.io/guides/portable-text-internal-and-external-links.

When working locally I can see the option to "Open in new window" in the editor, but in the live studio it says:

"This field is not defined in the schema, which could mean that the field definition has been removed or that someone else has added it to their own local project and have not deployed their changes yet."

Does anyone know why this is? I've deployed my changes so I'm not sure why it thinks it's not defined in the schema.

blockContent.js

marks: {
        decorators: [
          { title: 'Strong', value: 'strong' },
          { title: 'Emphasis', value: 'em' },
        ],
        
        annotations: [
          {
            name: 'link',
            type: 'object',
            title: 'URL',
            fields: [
              {
                title: 'URL',
                name: 'href',
                type: 'url',
              },
              // External links
              {
                title: 'Open in new window',
                name: 'blank',
                type: 'boolean'
              }
            ],
          },
        ],
      },

Live Studio enter image description here

Local Studio enter image description here


Solution

  • always remember to build your local project before deploying it

    $ npm run build

    $ npm run deploy