Shopify / cli

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

`dev` command failing on creating a node app #500

Closed rohanrajpal closed 2 years ago

rohanrajpal commented 2 years ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

App

Expected behavior

I created a new Shopify App and ran pnpm dev. Expected the Shopify Partner login link to appear.

Actual behavior

pnpm dev failed with exit code 1

amortizable-upside-app on ξ‚  main [?] is πŸ“¦ v1.0.0 via  v16.17.0
❯ pnpm dev                                                               (base)

> amortizable-upside-app@1.0.0 dev /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app
> shopify app dev

βœ” Dependencies installed
 ELIFECYCLE  Command failed with exit code 1.

Stack trace

here are the verbose shopify logs


 433   β”‚ [2022-09-20T10:34:02.104Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Running command app dev
 434   β”‚ [2022-09-20T10:34:02.105Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at node_modules/.pnpm/@shopify+cli-kit@3.13.0/node_modules/@shopify/cli-kit/package.json...
 435   β”‚ [2022-09-20T10:34:02.109Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at shopify.app.toml...
 436   β”‚ [2022-09-20T10:34:02.113Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at package.json...
 437   β”‚ [2022-09-20T10:34:02.113Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at package.json...
 438   β”‚ [2022-09-20T10:34:02.113Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Obtaining the dependency manager in directory /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app...
 439   β”‚ [2022-09-20T10:34:02.339Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at web/shopify.web.toml...
 440   β”‚ [2022-09-20T10:34:02.339Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at web/frontend/shopify.web.toml...
 441   β”‚ [2022-09-20T10:34:02.494Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]:
 442   β”‚ Running system process:
 443   β”‚   Β· Command: pnpm install
 444   β”‚   Β· Working directory: /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app
 445   β”‚
 446   β”‚ [2022-09-20T10:34:02.499Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]:
 447   β”‚ Running system process:
 448   β”‚   Β· Command: pnpm install
 449   β”‚   Β· Working directory: /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app/web
 450   β”‚
 451   β”‚ [2022-09-20T10:34:02.503Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]:
 452   β”‚ Running system process:
 453   β”‚   Β· Command: pnpm install
 454   β”‚   Β· Working directory: /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app/web/frontend
 455   β”‚
 456   β”‚ [2022-09-20T10:34:03.078Z 3d945676-42ae-48bf-82dc-6ea421f57808 INFO]: Dependencies installed
 457   β”‚ [2022-09-20T10:34:03.081Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at package.json...
 458   β”‚ [2022-09-20T10:34:03.082Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Ensuring that the user is authenticated with the Partners API with the following scopes:
 459   β”‚ []
 460   β”‚
 461   β”‚ [2022-09-20T10:34:03.709Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Secure store is available
 462   β”‚ [2022-09-20T10:34:03.710Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading session from the secure store...
 463   β”‚ [2022-09-20T10:34:03.717Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Validating existing session against the scopes:
 464   β”‚ [
 465   β”‚   "openid",
 466   β”‚   "https://api.shopify.com/auth/shop.admin.graphql",
 467   β”‚   "https://api.shopify.com/auth/shop.admin.themes",
 468   β”‚   "https://api.shopify.com/auth/partners.collaborator-relationships.readonly",
 469   β”‚   "https://api.shopify.com/auth/shop.storefront-renderer.devtools",
 470   β”‚   "https://api.shopify.com/auth/partners.app.cli.access"
 471   β”‚ ]
 472   β”‚ For applications:
 473   β”‚ {
 474   β”‚   "partnersApi": {
 475   β”‚     "scopes": []
 476   β”‚   }
 477   β”‚ }
 478   β”‚
 479   β”‚ [2022-09-20T10:34:04.166Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
 480   β”‚ [2022-09-20T10:34:04.507Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: The identity token is invalid: SyntaxError: Unexpected end of JSON input
 481   β”‚ [2022-09-20T10:34:04.509Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at node_modules/.pnpm/@shopify+cli-kit@3.13.0/node_modules/@shopify/cli-kit/package.json...
 482   β”‚ [2022-09-20T10:34:04.905Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]:
 483   β”‚ The validation of the token for application/identity completed with the following results:
 484   β”‚ - It's expired: true
 485   β”‚ - It's been revoked: true
 486   β”‚ - It's invalid in identity: true
 487   β”‚
 488   β”‚ [2022-09-20T10:34:04.905Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: The current session is valid but needs refresh. Refreshing...
 489   β”‚ [2022-09-20T10:34:05.284Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at node_modules/.pnpm/@shopify+cli-kit@3.13.0/node_modules/@shopify/cli-kit/package.json...
 490   β”‚ [2022-09-20T10:34:05.291Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]:
 491   β”‚ Running system process:
 492   β”‚   Β· Command: ruby -v
 493   β”‚   Β· Working directory: /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app
 494   β”‚
 495   β”‚ [2022-09-20T10:34:05.636Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Analytics event sent: {
 496   β”‚   "command": "app dev",
 497   β”‚   "time_start": 1663670042104,
 498   β”‚   "time_end": 1663670045277,
 499   β”‚   "total_time": 3173,
 500   β”‚   "success": false,
 501   β”‚   "cli_version": "3.13.0",
 502   β”‚   "ruby_version": "3.0.0",
 503   β”‚   "node_version": "16.17.0",
 504   β”‚   "is_employee": false,
 505   β”‚   "uname": "darwin arm64",
 506   β”‚   "env_ci": false,
 507   β”‚   "env_plugin_installed_any_custom": false,
 508   β”‚   "env_plugin_installed_shopify": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-ngrok\"]",
 509   β”‚   "env_shell": "fish",
 510   β”‚   "project_type": "node",
 511   β”‚   "app_extensions_any": false,
 512   β”‚   "app_extensions_breakdown": "{}",
 513   β”‚   "app_extensions_count": 0,
 514   β”‚   "app_extensions_custom_layout": false,
 515   β”‚   "app_extensions_function_any": false,
 516   β”‚   "app_extensions_function_count": 0,
 517   β”‚   "app_extensions_function_custom_layout": false,
 518   β”‚   "app_extensions_theme_any": false,
 519   β”‚   "app_extensions_theme_count": 0,
 520   β”‚   "app_extensions_theme_custom_layout": false,
 521   β”‚   "app_extensions_ui_any": false,
 522   β”‚   "app_extensions_ui_count": 0,
 523   β”‚   "app_extensions_ui_custom_layout": false,
 524   β”‚   "app_name_hash": "da2b0a5e7ece7986f6b6fdb506bef9dfe7eded18",
 525   β”‚   "app_path_hash": "89cf3df8e8168ee0c838a4d84eb3c7af2f5c43f4",
 526   β”‚   "app_scopes": "[\"write_products\"]",
 527   β”‚   "app_web_backend_any": true,
 528   β”‚   "app_web_backend_count": 1,
 529   β”‚   "app_web_custom_layout": false,
 530   β”‚   "app_web_frontend_any": true,
 531   β”‚   "app_web_frontend_count": 1,
 532   β”‚   "cmd_all_launcher": "pnpm",
 533   β”‚   "cmd_all_plugin": "@shopify/app",
 534   β”‚   "cmd_all_path_override": false,
 535   β”‚   "args": "",
 536   β”‚   "error_message": "",
 537   β”‚   "metadata": "{\"extraPublic\":{},\"extraSensitive\":{\"@shopify/app\":{}}}"
 538   β”‚ }
 539   β”‚ [2022-09-20T10:34:13.334Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]: Running command logs
 540   β”‚ [2022-09-20T10:34:13.335Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]: Reading the content of file at node_modules/.pnpm/@shopify+cli-kit@3.13.0/node_modules/@shopify/cli-kit/package.json...
 541   β”‚ [2022-09-20T10:34:13.337Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]: Creating an empty file at /Users/rohanrajpal/Library/Caches/shopify-cli-nodejs/shopify.cli.log...
 542   β”‚ [2022-09-20T10:34:13.348Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]:
 543   β”‚ Running system process:
 544   β”‚   Β· Command: less -NR /Users/rohanrajpal/Library/Caches/shopify-cli-nodejs/shopify.cli.log
 545   β”‚   Β· Working directory: /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app
 546   β”‚
 547   β”‚ [2022-09-20T10:34:44.347Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]: Reading the content of file at node_modules/.pnpm/@shopify+cli-kit@3.13.0/node_modules/@shopify/cli-kit/package.json...
 548   β”‚ [2022-09-20T10:34:44.354Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]:
 549   β”‚ Running system process:
 550   β”‚   Β· Command: ruby -v
 551   β”‚   Β· Working directory: /Users/rohanrajpal/Documents/experiments/shopify-theme/amortizable-upside-app
 552   β”‚
 553   β”‚ [2022-09-20T10:34:44.813Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]: Analytics event sent: {
 554   β”‚   "command": "logs",
 555   β”‚   "time_start": 1663670053334,
 556   β”‚   "time_end": 1663670084339,
 557   β”‚   "total_time": 31005,
 558   β”‚   "success": true,
 559   β”‚   "cli_version": "3.13.0",
 560   β”‚   "ruby_version": "3.0.0",
 561   β”‚   "node_version": "16.17.0",
 562   β”‚   "is_employee": false,
 563   β”‚   "uname": "darwin arm64",
 564   β”‚   "env_ci": false,
 565   β”‚   "env_plugin_installed_any_custom": false,
 566   β”‚   "env_plugin_installed_shopify": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-ngrok\"]",
 567   β”‚   "env_shell": "fish",
 568   β”‚   "cmd_all_launcher": "pnpm",
 569   β”‚   "cmd_all_plugin": "@shopify/cli",
 570   β”‚   "cmd_all_path_override": false,
 571   β”‚   "args": "",
 572   β”‚   "metadata": "{\"extraPublic\":{},\"extraSensitive\":{\"@shopify/app\":{}}}"
 573   β”‚ }
 574   β”‚ [2022-09-20T10:34:44.813Z 2a329601-016e-4588-a9b4-79226a30751a DEBUG]: Completed command logs


### Reproduction steps

1. Scaffold a new Shopify Node App with `pnpm/yarn/npm`
2. Run `pnpm dev`
3. Error appears and nothing happens

### Operating System

MacOs Monterey 12.5.1

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

3.13.0

### Shell

fish (tried with bash too, same issue)

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

16.17.0

### What language and version are you using in your application?

Node 16.17.0
rohanrajpal commented 2 years ago

I just spinned a new Ubuntu container and tried the steps there, seemed to work just fine.

I'm not sure what is wrong with my laptop, on comparing the logs, these lines are not present on the container on which everything runs perfectly

 479   β”‚ [2022-09-20T10:34:04.166Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
 480   β”‚ [2022-09-20T10:34:04.507Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: The identity token is invalid: SyntaxError: Unexpected end of JSON input
 481   β”‚ [2022-09-20T10:34:04.509Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]: Reading the content of file at node_modules/.pnpm/@shopify+cli-kit@3.13.0/node_modules/@shopify/cli-kit/package.json...
 482   β”‚ [2022-09-20T10:34:04.905Z 3d945676-42ae-48bf-82dc-6ea421f57808 DEBUG]:
 483   β”‚ The validation of the token for application/identity completed with the following results:
 484   β”‚ - It's expired: true
 485   β”‚ - It's been revoked: true
 486   β”‚ - It's invalid in identity: true
gonzaloriestra commented 2 years ago

Hi, thanks for creating the issue!

I'm not sure what's happening yet, but could you try running pnpm shopify auth logout? It looks like something is wrong with the authentication.

rohanrajpal commented 2 years ago

Hi, thanks for creating the issue!

I'm not sure what's happening yet, but could you try running pnpm shopify auth logout? It looks like something is wrong with the authentication.

WOW! This fixed it.

I wasted my entire day on this 😭. Most probably the issue was some conflict in migrating from old CLI to the new one. Although I had completely uninstalled the old cli before using the current one.

Perhaps we can document this somewhere?

gonzaloriestra commented 2 years ago

@rohanrajpal I'm sorry you wasted your day, but happy to see it worked.

I don't think it's related to the old CLI, but I've found a possible cause and created a PR to fix it. It shouldn't happen again (after the next release).

rohanrajpal commented 2 years ago

pnpm shopify auth logout

No worries. I'm glad there's a PR already with a potential fix :)