Shopify / cli

Build apps, themes, and hydrogen storefronts for Shopify
https://shopify.dev
MIT License
424 stars 126 forks source link

[Bug]: CLI erroring out on checkout ui extension on re-bundle with valid extension.toml #4709

Open JamiesonRoberts opened 3 hours ago

JamiesonRoberts commented 3 hours ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Extension

Expected behavior

When the CLI goes to re-bundle a checkout extension it should read back in the config file and continue to work rather than failing saying there is missing data that wasn't flagged the first time.

Actual behavior

When the CLI rebundles an extension during dev work its throws an error saying there is missing or incorrect data, even when there have been zero changes in the app config file.

Extension TOML is as follows

# Learn more about configuring your checkout UI extension:
# https://shopify.dev/api/checkout-extensions/checkout/configuration

# The version of APIs your extension will receive. Learn more:
# https://shopify.dev/docs/api/usage/versioning
api_version = "2024-10"

[[extensions]]
type = "ui_extension"
name = "Gift with Purchase"
handle = "gift-with-purchase"

# Controls where in Shopify your extension will be injected,
# and the file that contains your extension’s source code. Learn more:
# https://shopify.dev/docs/api/checkout-ui-extensions/unstable/extension-targets-overview

[[extensions.targeting]]
module = "./src/Checkout.tsx"
target = "purchase.checkout.block.render"

[extensions.capabilities]
# Gives your extension access to directly query Shopify’s storefront API.
# https://shopify.dev/docs/api/checkout-ui-extensions/unstable/configuration#api-access
api_access = true
network_access = true

# Gives your extension access to make external network calls, using the
# JavaScript `fetch()` API. Learn more:
# https://shopify.dev/docs/api/checkout-ui-extensions/unstable/configuration#network-access
# network_access = true

# Loads metafields on checkout resources, including the cart,
# products, customers, and more. Learn more:
# https://shopify.dev/docs/api/checkout-ui-extensions/unstable/configuration#metafields

# [[extensions.metafields]]
# namespace = "my_namespace"
# key = "my_key"
# [[extensions.metafields]]
# namespace = "my_namespace"
# key = "my_other_key"

# Defines settings that will be collected from merchants installing
# your extension. Learn more:
# https://shopify.dev/docs/api/checkout-ui-extensions/unstable/configuration#settings-definition

[[extensions.settings.fields]]
key = "extension_gwp_type"
type = "single_line_text_field"
name = "GWP Type"
description = "This defines the elegibility rules for the GWP"

[[extensions.settings.fields.validations]]
name = "choices"
value = '["Spend X Get Y", "Buy X Get Y"]'

[[extensions.settings.fields]]
key = "extension_promotion_start"
type = "date_time"
name = "GWP Start Date/Time"

[[extensions.settings.fields]]
key = "extension_promotion_end"
type = "date_time"
name = "GWP End Date/Time"

[[extensions.settings.fields]]
key = "extension_product_references"
type = "variant_reference"
name = "Offered Product"
description = "You have to select a variant, not a product. If you select a size variant, the entire product will be offered with a size selection to the customer"

Verbose output

15:59:47 │ graphiql │ GraphiQL server started on port 3457 15:59:47 │ client-address-validation │ Bundling UI extension client-address-validations... 15:59:47 │ aftership-estimates │ Bundling UI extension aftership-estimates... 15:59:47 │ checkout-recommendations │ Bundling UI extension checkout-recommendations... 15:59:47 │ comfort-guarantee │ Bundling UI extension comfort-guarantee... 15:59:47 │ final-sale-line-item-tag │ Bundling UI extension final-sale-line-item-tag... 15:59:47 │ gift-with-purchase │ Bundling UI extension gift-with-purchase... 15:59:47 │ free-shipping │ Bundling UI extension free-shipping... 15:59:47 │ text-content-block │ Bundling UI extension text-content-block... 15:59:47 │ checkout-recommendations │ Parsed locales for extension checkout-recommendations at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/checkout-recommendations 15:59:47 │ aftership-estimates │ Parsed locales for extension aftership-estimates at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/aftership-estimates 15:59:47 │ client-address-validation │ Parsed locales for extension client-address-validations at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/client-address-validations 15:59:47 │ final-sale-line-item-tag │ Parsed locales for extension final-sale-line-item-tag at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/final-sale-line-item-tag 15:59:47 │ gift-with-purchase │ Parsed locales for extension gift-with-purchase at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/gift-with-purchase 15:59:47 │ free-shipping │ Parsed locales for extension free-shipping at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/free-shipping 15:59:47 │ text-content-block │ Parsed locales for extension text-content-block at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/text-content-block 15:59:47 │ afterpay-gift-card-restri │ Building function afterpay-gift-card-restriction... 15:59:47 │ afterpay-gift-card-restri │ Building GraphQL types... 15:59:47 │ server-character-validati │ Building function server-character-validation... 15:59:47 │ server-character-validati │ Building GraphQL types... 15:59:47 │ afterpay-intl-restriction │ Building function afterpay-intl-restriction... 15:59:47 │ afterpay-intl-restriction │ Building GraphQL types... 15:59:48 │ text-content-block │ text-content-block successfully built 15:59:48 │ comfort-guarantee │ comfort-guarantee successfully built 15:59:48 │ final-sale-line-item-tag │ final-sale-line-item-tag successfully built 15:59:48 │ gift-with-purchase │ gift-with-purchase successfully built 15:59:48 │ client-address-validation │ client-address-validations successfully built 15:59:48 │ aftership-estimates │ aftership-estimates successfully built 15:59:48 │ checkout-recommendations │ checkout-recommendations successfully built 15:59:49 │ free-shipping │ free-shipping successfully built 15:59:49 │ final-sale-line-item-tag │ Parsed locales for extension final-sale-line-item-tag at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/final-sale-line-item-tag 15:59:49 │ text-content-block │ Parsed locales for extension text-content-block at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/text-content-block 15:59:49 │ client-address-validation │ Parsed locales for extension client-address-validations at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/client-address-validations 15:59:49 │ gift-with-purchase │ Parsed locales for extension gift-with-purchase at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/gift-with-purchase 15:59:49 │ aftership-estimates │ Parsed locales for extension aftership-estimates at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/aftership-estimates 15:59:49 │ free-shipping │ Parsed locales for extension free-shipping at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/free-shipping 15:59:50 │ checkout-recommendations │ Parsed locales for extension checkout-recommendations at /Users/jamiesonroberts/****/shopify-checkout-extensions/extensions/checkout-recommendations 15:59:50 │ server-character-validati │ Bundling JS function... 15:59:50 │ afterpay-gift-card-restri │ Bundling JS function... 15:59:50 │ afterpay-intl-restriction │ Bundling JS function... 15:59:50 │ server-character-validati │ Running javy... 15:59:50 │ afterpay-gift-card-restri │ Running javy... 15:59:50 │ afterpay-intl-restriction │ Running javy... 15:59:51 │ comfort-guarantee │ Draft updated successfully for extension: comfort-guarantee 15:59:51 │ text-content-block │ Draft updated successfully for extension: text-content-block 15:59:51 │ client-address-validation │ Draft updated successfully for extension: client-address-validations 15:59:51 │ final-sale-line-item-tag │ Draft updated successfully for extension: final-sale-line-item-tag 15:59:51 │ free-shipping │ Draft updated successfully for extension: free-shipping 15:59:51 │ aftership-estimates │ Draft updated successfully for extension: aftership-estimates 15:59:51 │ checkout-recommendations │ Draft updated successfully for extension: checkout-recommendations 15:59:52 │ gift-with-purchase │ Draft updated successfully for extension: gift-with-purchase 15:59:52 │ server-character-validati │ Done! 15:59:52 │ afterpay-intl-restriction │ Done! 15:59:52 │ afterpay-gift-card-restri │ Done! 15:59:53 │ server-character-validati │ Draft updated successfully for extension: server-character-validation 15:59:53 │ afterpay-gift-card-restri │ Draft updated successfully for extension: afterpay-gift-card-restriction 15:59:53 │ afterpay-intl-restriction │ Draft updated successfully for extension: afterpay-intl-restriction 16:01:46 │ server-character-validati │ Function export "run" executed successfully using 0.1627M instructions. 16:01:46 │ server-character-validati │ └ Open log file (1219e9) 16:01:47 │ server-character-validati │ Function export "run" executed successfully using 0.1627M instructions. 16:01:47 │ server-character-validati │ └ Open log file (22e334) 16:01:48 │ server-character-validati │ Function export "run" executed successfully using 0.1627M instructions. 16:01:48 │ server-character-validati │ └ Open log file (963c49) 16:01:50 │ server-character-validati │ Function export "run" executed successfully using 0.1627M instructions. 16:01:50 │ server-character-validati │ └ Open log file (5c290b) 16:15:41 │ gift-with-purchase │ Bundling UI extension gift-with-purchase...

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

› Press d │ toggle development store preview: ✔ on › Press g │ open GraphiQL (Admin API) in your browser › Press p │ preview in your browser › Press q │ quit

Preview URL: https://apache-currently-size-sg.trycloudflare.com/extensions/dev-console GraphiQL URL: http://localhost:3457/graphiql

Error: App configuration is not valid Validation errors in extensions/gift-with-purchase/shopify.extension.toml:

• [type]: Required

at abort2 (file:///Users/jamiesonroberts/********/shopify-checkout-extensions/node_modules/@shopify/cli/dist/index.js:167142:63)
at parseConfigurationObjectAgainstSpecification (file:///Users/jamiesonroberts/********/shopify-checkout-extensions/node_modules/@shopify/cli/dist/index.js:163453:14)
at reloadExtensionConfig (file:///Users/jamiesonroberts/********/shopify-checkout-extensions/node_modules/@shopify/cli/dist/index.js:167153:25)

Reproduction steps

1. 2. 3.

Operating System

OSX

Shopify CLI version (check your project's package.json if you're not sure)

3.69.0

Shell

ZSH

Node version (run node -v if you're not sure)

v20.17.0

What language and version are you using in your application?

No response

JamiesonRoberts commented 3 hours ago

Its worth noting that this bug is massively interrupting development of checkout extensions while using the latest version of the CLI (3.69.0)