Error after importing document which passed all checks

I'm writing a script to generate JSON that is compatible with the Prismic importer, using the structure from Prismic exporter as a reference for formatting of the object.

I successfully imported and published a page, but gatsby-source-prismic threw the following error:

Cannot read properties of null (reading 'link_type')

My link field looks like this, based on the exported JSON link field:

"link":{"url":"myLink","preview":null}

After I deleted the imported document, the site built successfully again.

FIXED:

I changed the field to be

"link":{"url":"myLink","preview":null,"link_type":"Web"}

Or for empty links

"link":{"url":null,"preview":null,"link_type":"Web"}

2 Likes