cli: [Bug]: Error coming from `npm exec -- graphql-code-generator --config package.json` on creating payment customization with Javascript

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Extension

Expected behavior

Create payment extension

Actual behavior

Using npm run generate extension

Error coming from npm exec -- graphql-code-generator --config package.json

Command failed with exit code 1: npm exec – graphql-code-generator --config package.json

Usage: npm <command>

where <command> is one of: access, adduser, audit, bin, bugs, c, cache, ci, cit, clean-install, clean-install-test, completion, config, create, ddp, dedupe, deprecate, dist-tag, docs, doctor, edit, explore, fund, get, help, help-search, hook, i, init, install, install-ci-test, install-test, it, link, list, ln, login, logout, ls, org, outdated, owner, pack, ping, prefix, profile, prune, publish, rb, rebuild, repo, restart, root, run, run-script, s, se, search, set, shrinkwrap, star, stars, start, stop, t, team, test, token, tst, un, uninstall, unpublish, unstar, up, update, v, version, view, whoami

npm <command> -h quick help on <command> npm -l display full usage info npm help <term> search for help on <term> npm help npm involved overview

Verbose output

> shopify app generate extension --verbose

2023-06-05T12:47:32.172Z: Running command app generate extension
2023-06-05T12:47:32.199Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]

2023-06-05T12:47:32.204Z: Getting session store...
2023-06-05T12:47:32.212Z: Validating existing session against the scopes:
[
  "openid",
  "https://api.shopify.com/auth/shop.admin.graphql",
  "https://api.shopify.com/auth/shop.admin.themes",
  "https://api.shopify.com/auth/partners.collaborator-relationships.readonly",
  "https://api.shopify.com/auth/shop.storefront-renderer.devtools",
  "https://api.shopify.com/auth/partners.app.cli.access"
]
For applications:
{
  "partnersApi": {
    "scopes": []
  }
}

2023-06-05T12:47:32.218Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-06-05T12:47:32.219Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
 - User-Agent: Shopify CLI; v=3.46.2
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-06-05T12:47:32.568Z: Request to https://accounts.shopify.com/oauth/introspection completed in 328 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"e7d0d6cb4737081f83ef93c065135d26"
 - x-request-id: cfe9fe12-cb73-46e3-9dc9-6eab876bebdf
    
2023-06-05T12:47:32.579Z: The identity token is valid: true
2023-06-05T12:47:32.580Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false
  
2023-06-05T12:47:32.582Z: Verifying that the user has a Partner organization
2023-06-05T12:47:32.584Z: Sending "Partners" GraphQL request:
  {
    organizations(first: 1) {
      nodes {
        id
      }
    }
  }

With request headers:
 - User-Agent: Shopify CLI; v=3.46.2
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-06-05T12:47:32.972Z: Request to https://partners.shopify.com/api/cli/graphql completed in 356 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"c513109d2db31ce33de23913f573ea25"
 - x-request-id: 2865d65d-db4f-457c-9662-36df7089a32e
    
2023-06-05T12:47:32.977Z: Reading cached app information for directory C:/...
2023-06-05T12:47:32.979Z: Sending "Partners" GraphQL request:
  query FindOrganization($id: ID!) {
    organizations(id: $id, first: 1) {
      nodes {
        id
        businessName
        website
        betas {
          cliTunnelAlternative
        }
      }
    }
  }

With variables:
{
  "id": "1200067"
}

With request headers:
 - User-Agent: Shopify CLI; v=3.46.2
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-06-05T12:47:33.252Z: Request to https://partners.shopify.com/api/cli/graphql completed in 262 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"e564d4515bde597b7039b6385b15b802"
 - x-request-id: f7823b78-7e71-4560-8530-b06d1ac7f185
    
2023-06-05T12:47:33.254Z: Sending "Partners" GraphQL request:
  query FindApp($apiKey: String!) {
    app(apiKey: $apiKey) {
      id
      title
      apiKey
      organizationId
      apiSecretKeys {
        secret
      }
      appType
      grantedScopes
      betas {
        unifiedAppDeployment
      }
    }
  }

With variables:
{
  "apiKey": "c8de9a21db20bbd0c5b74c9cb432f18b"
}

With request headers:
 - User-Agent: Shopify CLI; v=3.46.2
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-06-05T12:47:34.014Z: Request to https://partners.shopify.com/api/cli/graphql completed in 750 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"392f21ed991bf35946d1147cc67e87cb"
 - x-request-id: 2a67889c-06c6-47b0-83fe-33cf561c7f26
    
2023-06-05T12:47:34.020Z: Obtaining the dependency manager in directory C:/Users/radua/Desktop/Fluxsales Functions/hide-payments...
╭─ info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                      │
│  Using your previous dev settings:                                                                                                                                   │
│                                                                                                                                                                      │
│    • Org:          FLUXSALES                                                                                                                                         │
│    • App:          hide-payments                                                                                                                                     │
│                                                                                                                                                                      │
│  To reset your default dev config, run `yarn dev --reset`                                                                                                            │
│                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

2023-06-05T12:47:34.239Z: Sending "Partners" GraphQL request:
  query fetchSpecifications($api_key: String!) {
    extensionSpecifications(apiKey: $api_key) {
      name
      externalName
      externalIdentifier
      identifier
      gated
      options {
        managementExperience
        registrationLimit
      }
      features {
        argo {
          surface
        }
      }
    }
  }

With variables:
{
  "api_key": "c8de9a21db20bbd0c5b74c9cb432f18b"
}

With request headers:
 - User-Agent: Shopify CLI; v=3.46.2
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-06-05T12:47:34.536Z: Request to https://partners.shopify.com/api/cli/graphql completed in 286 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"105e4d6110087756a8c7f619b7f47ae6"
 - x-request-id: 70e36500-8611-49d1-978c-488dfd99c893
    
2023-06-05T12:47:34.802Z: Reading the content of file at shopify.app.toml...
2023-06-05T12:47:34.832Z: Reading the content of file at package.json...
2023-06-05T12:47:34.835Z: Reading the content of file at package.json...
2023-06-05T12:47:34.837Z: Obtaining the dependency manager in directory C:/Users/radua/Desktop/Fluxsales Functions/hide-payments...
2023-06-05T12:47:35.522Z: Reading the content of file at web/shopify.web.toml...
2023-06-05T12:47:35.523Z: Reading the content of file at web/frontend/shopify.web.toml...
2023-06-05T12:47:35.523Z: Reading the content of file at node_modules/shopify-app-template-node/shopify.web.toml...
2023-06-05T12:47:35.524Z: Reading the content of file at node_modules/shopify-frontend-template-react/shopify.web.toml...
2023-06-05T12:47:35.525Z: Reading the content of file at node_modules/shopify-app-template-node/frontend/shopify.web.toml...
2023-06-05T12:47:35.570Z: Reading the content of file at package.json...
2023-06-05T12:47:35.572Z: Unable to decide project type as multiple web backends
2023-06-05T12:47:35.573Z: Sending "Partners" GraphQL request:
  query RemoteTemplateSpecifications($version: String) {
    templateSpecifications(version: $version) {
      identifier
      name
      group
      supportLinks
      types {
        url
        type
        extensionPoints
        supportedFlavors {
          name
          value
?  Type of extension?

   Analytics
>  (1) Web Pixel

   Discounts and checkout
   (2) Checkout UI
   (3) Function - Cart and Checkout Validation
?  Type of extension?
✔  Function - Payment customization

?  Extension name (internal only):
✔  payments

?  What would you like to work in?
✔  JavaScript

2023-06-05T12:47:54.109Z: Creating directory at extensions/payments...
2023-06-05T12:47:54.149Z: Creating directory at C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download...
2023-06-05T12:47:54.155Z: Git-cloning repository https://github.com/Shopify/function-examples into C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download...
2023-06-05T12:47:54.317Z:
Running system process:
  · Command: git --version
  · Working directory: 

2023-06-05T12:47:59.348Z: Copying template from directory C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default to extensions/payments
2023-06-05T12:47:59.370Z: Checking if C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/src/index.test.liquid is a directory...
2023-06-05T12:47:59.375Z: Checking if C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/src/index.liquid is a directory...
2023-06-05T12:47:59.380Z: Checking if C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/shopify.function.extension.toml.liquid is a directory...
2023-06-05T12:47:59.385Z: Checking if C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/schema.graphql is a directory...
2023-06-05T12:47:59.391Z: Checking if C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/package.json.liquid is a directory...
2023-06-05T12:47:59.396Z: Checking if C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/input.graphql.liquid is a directory...
2023-06-05T12:47:59.401Z: Checking if C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/.gitignore is a directory...
2023-06-05T12:47:59.411Z: Creating directory at extensions/payments/src...
2023-06-05T12:47:59.416Z: Creating directory at extensions/payments/src...
2023-06-05T12:47:59.421Z: Creating directory at extensions/payments...
2023-06-05T12:47:59.427Z: Copying file from C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/schema.graphql to extensions/payments/schema.graphql...
2023-06-05T12:47:59.436Z: Creating directory at extensions/payments...
2023-06-05T12:47:59.444Z: Creating directory at extensions/payments...
2023-06-05T12:47:59.452Z: Copying file from C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/.gitignore to extensions/payments/.gitignore...
2023-06-05T12:47:59.470Z: Reading the content of file at C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/src/index.test.liquid...
2023-06-05T12:47:59.526Z: Reading the content of file at C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/src/index.liquid...
2023-06-05T12:47:59.535Z: Reading the content of file at C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/shopify.function.extension.toml.liquid...
2023-06-05T12:47:59.549Z: Reading the content of file at C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/package.json.liquid...
2023-06-05T12:47:59.558Z: Reading the content of file at C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/input.graphql.liquid...
2023-06-05T12:47:59.587Z: Copying file from C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/src/index.test.liquid to extensions/payments/src/index.test...
2023-06-05T12:47:59.593Z: Copying file from C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/src/index.liquid to extensions/payments/src/index...
2023-06-05T12:47:59.599Z: Copying file from C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/shopify.function.extension.toml.liquid to extensions/payments/shopify.function.extension.toml...
2023-06-05T12:47:59.606Z: Copying file from C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/package.json.liquid to extensions/payments/package.json...
2023-06-05T12:47:59.624Z: Copying file from C:/Users/radua/AppData/Local/Temp/7fc9ea6758a23e1093b647542686938b/download/checkout/javascript/payment-customization/default/input.graphql.liquid to extensions/payments/input.graphql...
2023-06-05T12:47:59.645Z: Writing some content to file at extensions/payments/shopify.function.extension.toml...
2023-06-05T12:47:59.653Z: Writing some content to file at extensions/payments/package.json...
2023-06-05T12:47:59.666Z: Writing some content to file at extensions/payments/src/index.test...
2023-06-05T12:47:59.674Z: Writing some content to file at extensions/payments/src/index...
2023-06-05T12:47:59.679Z: Writing some content to file at extensions/payments/input.graphql...
2023-06-05T12:48:00.046Z: Adding the following dependencies if needed:
[
  {
    "name": "@shopify/shopify_function",
    "version": "0.0.3"
  },
  {
    "name": "javy",
    "version": "0.1.0"
  }
]
With options:
{
  "packageManager": "yarn",
  "type": "prod",
  "directory": ""
}
  
2023-06-05T12:48:00.059Z: Reading the content of file at extensions/payments/package.json...
2023-06-05T12:48:00.105Z:
Running system process:
  · Command: yarn add @shopify/shopify_function@0.0.3 javy@0.1.0 --prod

2023-06-05T12:48:23.732Z:
Running system process:
  · Command: npm exec -- graphql-code-generator --config package.json


2023-06-05T12:48:25.131Z: Removing file at extensions/payments...
── external error ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Error coming from `npm exec -- graphql-code-generator --config package.json`

Command failed with exit code 1: npm exec -- graphql-code-generator --config package.json

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, fund, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    C:\Users\radua\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.14.18 C:\Users\radua\node_modules\npm


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

2023-06-05T12:48:25.212Z: Obtaining the dependency manager in directory C:/Users/radua/Desktop/Fluxsales Functions/hide-payments...
2023-06-05T12:48:25.510Z: 
Running system process:
  · Command: ruby -v
  · Working directory: C:/Users/radua/Desktop/Fluxsales Functions/hide-payments

2023-06-05T12:48:25.548Z: Obtaining the dependency manager in directory C:/Users/radua/Desktop/Fluxsales Functions/hide-payments...
2023-06-05T12:48:25.835Z: 
Running system process:
  · Command: ruby -v

2023-06-05T12:48:26.052Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 204 ms
With response headers:
 - x-request-id: 98bee140-a65b-47f5-992e-f56aef3d0868
    
2023-06-05T12:48:26.055Z: Analytics event sent: {
  "command": "app scaffold extension",
  "time_start": 1685969252175,
  "time_end": 1685969305160,
  "total_time": 52985,
  "success": false,
  "cli_version": "3.46.2",
  "ruby_version": "3.1.1",
  "node_version": "18.16.0",
  "is_employee": false,
  "uname": "windows amd64",
  "env_ci": false,
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\",\"@shopify/plugin-ngrok\"]",
  "env_shell": "cmd.exe",
  "env_device_id": "29e54ce758c790f3af833deec60412abaf6f0838",
  "env_cloud": "localhost",
  "env_package_manager": "yarn",
  "cmd_scaffold_required_auth": true,
  "cmd_scaffold_template_custom": false,
  "cmd_scaffold_type_owner": "@shopify/app",
  "app_extensions_any": false,
  "app_extensions_breakdown": "{}",
  "app_extensions_count": 0,
  "app_extensions_custom_layout": false,
  "app_extensions_function_any": false,
  "app_extensions_function_count": 0,
  "app_extensions_function_custom_layout": false,
  "app_extensions_theme_any": false,
  "app_extensions_theme_count": 0,
  "app_extensions_theme_custom_layout": false,
  "app_extensions_ui_any": false,
  "app_extensions_ui_count": 0,
  "app_extensions_ui_custom_layout": false,
  "app_name_hash": "325ab968f84d66d69de8b6430d4e22a64e4d8ece",
  "app_path_hash": "ee33374068b641e325e722f702311bf19716c1f5",
  "app_scopes": "[\"write_products\"]",
  "app_web_backend_any": true,
  "app_web_backend_count": 2,
  "app_web_custom_layout": true,
  "app_web_frontend_any": true,
  "app_web_frontend_count": 3,
  "env_package_manager_workspaces": true,
  "cmd_scaffold_template_flavor": "vanilla-js",
  "cmd_scaffold_type": "payment_customization",
  "cmd_scaffold_used_prompts_for_type": true,
  "cmd_all_launcher": "npm",
  "cmd_all_topic": "app generate",
  "cmd_all_plugin": "@shopify/app",
  "cmd_all_verbose": true,
  "cmd_all_path_override": true,
  "cmd_all_path_override_hash": "ee33374068b641e325e722f702311bf19716c1f5",
  "args": "--verbose",
  "error_message": "Command failed with exit code 1: npm exec -- graphql-code-generator --config package.json\n\nUsage: npm <command>\n\nwhere <command> is one of:\n    access, adduser, audit, bin, bugs, c, cache, ci, cit,\n    clean-install, clean-install-test, completion, config,\n    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,\n    edit, explore, fund, get, help, help-search, hook, i, init,\n    install, install-ci-test, install-test, it, link, list, ln,\n    login, logout, ls, org, outdated, owner, pack, ping, prefix,\n    profile, prune, publish, rb, rebuild, repo, restart, root,\n    run, run-script, s, se, search, set, shrinkwrap, star,\n    stars, start, stop, t, team, test, token, tst, un,\n    uninstall, unpublish, unstar, up, update, v, version, view,\n    whoami\n\nnpm <command> -h  quick help on <command>\nnpm -l            display full usage info\nnpm help <term>   search for help on <term>\nnpm help npm      involved overview\n\nSpecify configs in the ini-formatted file:\n    C:\\Users\\radua\\.npmrc\nor on the command line via: npm <command> --key value\nConfig info can be viewed via: npm help config\n\nnpm@6.14.18 C:\\Users\\radua\\node_modules\\npm\n",
  "env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\",\"@shopify/plugin-ngrok\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}

Reproduction steps

1.Create a new app npm init @shopify/app@latest 2.Create a new extension npm run generate extension

Operating System

Windows 10

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

3.46.2

Shell

No response

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

v18.16.0

What language and version are you using in your application?

Node v18.16.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Also found this error on 2024 20th May; just after creating app from the scratch using yarn, had to install @shopify/shopify_function and javy on root package.json for make it work

Im also getting

Error coming from `npm exec -- graphql-code-generator --config package.json`

Command failed with exit code 1: npm exec -- graphql-code-generator --config
package.json

Current Shopify CLI version: 3.56.1

For anyone stumbling upon this - realized this was because I had extensions in my app created before the packages were managed by the extensions themselves. After creating a package.json in my function extensions and adding:

  "dependencies": {
    "@shopify/shopify_function": "0.1.0",
    "javy": "0.1.1"
  }, 

It started working again

Also found this error on 2024 20th May; just after creating app from the scratch using yarn, had to install @shopify/shopify_function and javy on root package.json for make it work

Yes, I have the same issue

Here is the old package.json

  "dependencies": {
       "@shopify/app": "~3.58.2",
       "@shopify/cli": "~3.64.1",
       "@shopify/shopify_function": "0.1.0",
       "javy": "0.1.1"
   },

Here is the updated one withthe error “npm exec – graphql-code-generator --config package.json”

  "dependencies": {
    "@shopify/cli": "~3.77.0",
  },

Fixed, after I added javy and @shopify/shopify_function

  "dependencies": {
    "@shopify/cli": "~3.77.0",
    "@shopify/shopify_function": "1.0.6",
    "javy": "0.1.2"
  },