Shopify/lighthouse-ci-action

Getting "ERROR update templates/product.json" error after adding product metafields

szimek opened this issue · 1 comments

Hi!

One of our editors added some new product metafields and it looks like it broke this action - I'm not 100% sure this is the cause, but the error message seems to suggest it. This is the error I'm seeing:

==============================
Configuring shopify CLI
Will run Lighthouse CI on https://***
==============================
Creating development theme
ERROR update templates/product.json:
  Dynamic source 'product.metafields.my_fields.delivery_time.value' does not exist.
  Dynamic source 'product.metafields.my_fields.product_usp_heading_.value' does not exist.
  Dynamic source 'product.metafields.my_fields.product_usp_image_1.value' does not exist.
  Dynamic source 'product.metafields.my_fields.product_usp_header_1.value' does not exist.
  Dynamic source 'product.metafields.my_fields.product_usp_text_1 | metafield_tag' does not exist.
  Dynamic source 'product.metafields.my_fields.product_usp_image_2.value' does not exist.
  Dynamic source 'product.metafields.my_fields.product_usp_header_2.value' does not exist.
  Dynamic source 'product.metafields.my_fields.product_usp_text_2 | metafield_tag' does not exist.
  ...
ERROR update config/settings_data.json:
  Preset 'Craft' Invalid value for type in block 'text'. Type must be defined in schema.
{"theme":{"id":128171704554,"name":"Development (2f132e-11520a0ffba1)","role":"development","shop":"***","editor_url":"https://***/admin/themes/128171704554/editor","preview_url":"https://***/?preview_theme_id=128171704554"}}

What should we do in such case? Do I manually have to add these metafields in the store used by this action?

I managed to fix this error by manually adding all the missing product metafields to the development store used by this action.

What would be the best way to automate it? I don't think there's any webhook that is triggered whenever a new metafield definition is added via Shopify admin, so this sync would rather have to be part of CI flow, correct?