๐Ÿ˜Ž Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Incorrect options declaration in reference

The reference field allows you to define options for the input component. These options should be defined under the options key and be an object.

If you are encountering this error, it usually means that you've defined an options key which is not an object:

export default {
  name: 'blogPost',
  type: 'document',
  fields: [
    // ... your other schema fields ...
    {
      name: 'author',
      type: 'reference',
      to: [{type: 'person'}],
      
      // INCORRECT
      options: [{some: 'option'}],
      
      // CORRECT
      options: {
        some: 'option'
      }
    }
  ]
}

Was this article helpful?