Shopify / cli

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

[Bug]: CLI `dev` command fails with no port available for GraphiQL regardless of port chosen (MacOS) #3578

Closed mikefortney closed 5 months ago

mikefortney commented 5 months ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

App

Expected behavior

CLI dev command should launch without issues on MacOS

Actual behavior

CLI dev command fails with the error 'Port 3457 is not available for serving GraphiQL' and offers a command option to use a different port. No matter which port I choose, the behavior is the same. I have looked into the code a bit, and I see that you are using get-port-please to check port availability. There may be an issue in that package that misreports the availability of the port, OR there is something else blocking the port availability even tho it is reported as available.

Verbose output

➜  inspired-shopify-app git:(mf-test-20241315) ✗ yarn dev --verbose
2024-03-19T17:27:38.713Z: Running command app dev
2024-03-19T17:27:38.725Z: Getting a random port...
2024-03-19T17:27:38.729Z: Random port obtained: 52870
2024-03-19T17:27:38.730Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]

2024-03-19T17:27:38.732Z: Getting session store...
2024-03-19T17:27:38.737Z: 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",
  "https://api.shopify.com/auth/destinations.readonly"
]
For applications:
{
  "partnersApi": {
    "scopes": []
  }
}

2024-03-19T17:27:38.738Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2024-03-19T17:27:38.739Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-19T17:27:39.130Z: Request to https://accounts.shopify.com/oauth/introspection completed in 380 ms
With response headers:
 - cache-control: no-cache
 - content-type: text/html
 - x-request-id: 46843e6b-21de-4a7f-b262-96eec0f3c1d7-1710869259

2024-03-19T17:27:39.131Z: The Introspection request failed with:
 - status: 401
 - www-authenticate header: "error=\"invalid_token\",error_description=\"The access token provided is expired, revoked, malformed or invalid for other reasons.\""
 - body: ""
2024-03-19T17:27:39.132Z: 
The validation of the token for application/identity completed with the following results:
- It's expired: true
- It's invalid in identity: true

2024-03-19T17:27:39.132Z: The current session is valid but needs refresh. Refreshing...
2024-03-19T17:27:39.133Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_CjQIxKXUrwYQ5N3UrwZSJggBEhCAGQDDuDxGopeb5USkLGkiGhDtOsewZIhKMqkLFKp1UTYOEkATSb8AcchXZ3Lew-IMl_vqH3WkFdEuVeUZvRJQJhmxZBWgPwfiGjMBZWrmhmEru77lNcZON58bc3-T1EWuhSgG&refresh_token=atkn_CiEIxKXUrwYQxL_ysAaiARIKEO06x7BkiEoyqQsUqnVRNg4SQC1FiqyF11urJmEgxLA39M79C2qUdHlCBvq12paIGbzkOw5SV5AsFjrS0ql3tKT9SJmKZwA305QCR6ELr2ggFQE&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-19T17:27:39.523Z: Request to https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_CjQIxKXUrwYQ5N3UrwZSJggBEhCAGQDDuDxGopeb5USkLGkiGhDtOsewZIhKMqkLFKp1UTYOEkATSb8AcchXZ3Lew-IMl_vqH3WkFdEuVeUZvRJQJhmxZBWgPwfiGjMBZWrmhmEru77lNcZON58bc3-T1EWuhSgG&refresh_token=atkn_CiEIxKXUrwYQxL_ysAaiARIKEO06x7BkiEoyqQsUqnVRNg4SQC1FiqyF11urJmEgxLA39M79C2qUdHlCBvq12paIGbzkOw5SV5AsFjrS0ql3tKT9SJmKZwA305QCR6ELr2ggFQE&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 completed in 390 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/"535cbdc080d1eaf30e99d9a5b7c04283"
 - x-request-id: e0ddded3-6dbb-42ac-b9ca-ff428a2de6b2-1710869259

2024-03-19T17:27:39.527Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-19T17:27:39.527Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-19T17:27:39.527Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-19T17:27:39.740Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=**** completed in 211 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/"dad71ccbebfd6289dfefbd4e010ee4b6"
 - x-request-id: 88210735-8739-4749-9bc5-29ec1e175303-1710869259

2024-03-19T17:27:39.758Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=**** completed in 227 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/"a08dd4ce55bb10fc61e71464e7563012"
 - x-request-id: 01b9adac-ce3a-45e0-9ffa-7dfafa78570d-1710869259

2024-03-19T17:27:40.082Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=**** completed in 550 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/"62df31b05164ba9493624d55c049a482"
 - x-request-id: d5300d9c-1221-412d-b46b-623e8e0632fb-1710869260

2024-03-19T17:27:40.083Z: Setting session store...
2024-03-19T17:27:40.109Z: Verifying that the user has a Partner organization
2024-03-19T17:27:40.114Z: Sending "Partners" GraphQL request:
  {
    organizations(first: 1) {
      nodes {
        id
      }
    }
  }

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

2024-03-19T17:27:40.573Z: Request to https://partners.shopify.com/api/cli/graphql completed in 436 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"5e2fc688801cd6ac59f4782d82e17e45"
 - x-request-id: 9f31d70b-bf2b-4b90-ad2c-8661c0ba5b92-1710869260

2024-03-19T17:27:40.579Z: Sending "Partners" GraphQL request:
  query currentAccountInfo {
    currentAccountInfo {
      __typename
      ... on ServiceAccount {
        orgName
      }
      ... on UserAccount {
        email
      }
    }
  }

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

2024-03-19T17:27:40.788Z: Request to https://partners.shopify.com/api/cli/graphql completed in 207 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"779bdb3bdf728cbb700f66f54e318b79"
 - x-request-id: c88b8118-8a26-42e8-9a0e-b1ecc2e3f3a6-1710869260

2024-03-19T17:27:40.792Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-19T17:27:40.800Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-19T17:27:40.803Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-19T17:27:40.804Z: Reading the content of file at shopify.app.toml...
2024-03-19T17:27:40.809Z: Reading the content of file at shopify.app.toml...
2024-03-19T17:27:40.813Z: Reading the content of file at shopify.app.demo.toml...
2024-03-19T17:27:40.814Z: Reading the content of file at shopify.app.demo2.toml...
2024-03-19T17:27:40.814Z: Reading the content of file at shopify.app.demo3.toml...
2024-03-19T17:27:40.814Z: Reading the content of file at shopify.app.demo4.toml...
2024-03-19T17:27:40.815Z: Reading the content of file at shopify.app.local.example.toml...
2024-03-19T17:27:40.815Z: Reading the content of file at shopify.app.prod.toml...
2024-03-19T17:27:40.815Z: Reading the content of file at shopify.app.stage.toml...
2024-03-19T17:27:40.815Z: Reading the content of file at shopify.app.toml...
2024-03-19T17:27:40.816Z: Reading the content of file at shopify.app.local.toml...
2024-03-19T17:27:40.892Z: Sending "Partners" GraphQL request:
  query FindApp($apiKey: String!) {
    app(apiKey: $apiKey) {
      id
      title
      apiKey
      organizationId
      apiSecretKeys {
        secret
      }
      appType
      grantedScopes
      developmentStorePreviewEnabled
      disabledBetas
    }
  }

With variables:
{
  "apiKey": "*****"
}

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

2024-03-19T17:27:41.620Z: Request to https://partners.shopify.com/api/cli/graphql completed in 726 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"73e9eed050dd033fe08002cd88700ab1"
 - x-request-id: b6007a8d-bdc9-461e-9225-71f8fe6662f0-1710869261

2024-03-19T17:27:41.626Z: Sending "Partners" GraphQL request:
  query FindOrganization($id: ID!) {
    organizations(id: $id, first: 1) {
      nodes {
        id
        businessName
        website
      }
    }
  }

With variables:
{
  "id": "1964153"
}

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

2024-03-19T17:27:41.899Z: Request to https://partners.shopify.com/api/cli/graphql completed in 272 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"7377122911fe733fe3a57840b614b221"
 - x-request-id: b13de1a2-f19c-4657-90e7-7d22946a09f4-1710869261

2024-03-19T17:27:41.905Z: Sending "Partners" GraphQL request:
  query FindOrganization($id: ID!, $shopDomain: String) {
    organizations(id: $id, first: 1) {
      nodes {
        id
        businessName
        website
        stores(shopDomain: $shopDomain, first: 1, archived: false) {
          nodes {
            shopId
            link
            shopDomain
            shopName
            transferDisabled
            convertableToPartnerTest
          }
        }
      }
    }
  }

With variables:
{
  "id": "1964153",
  "shopDomain": "mike-dev-20240307.myshopify.com"
}

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

2024-03-19T17:27:42.196Z: Request to https://partners.shopify.com/api/cli/graphql completed in 289 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"19dc62446398e310105635298dfb8679"
 - x-request-id: 66b254bb-7796-446f-94eb-ac6e424c6dd5-1710869262

2024-03-19T17:27:42.201Z: Sending "Partners" GraphQL request:
  query fetchSpecifications($api_key: String!) {
    extensionSpecifications(apiKey: $api_key) {
      name
      externalName
      externalIdentifier
      identifier
      gated
      experience
      options {
        managementExperience
        registrationLimit
      }
      features {
        argo {
          surface
        }
      }
    }
  }

With variables:
{
  "api_key": "549dee2476c0f03fee6e83b6cb4aa43b"
}

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

2024-03-19T17:27:42.474Z: Request to https://partners.shopify.com/api/cli/graphql completed in 271 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"9ab17d4da8931884f8e467f5f1f46318"
 - x-request-id: 65a6aae3-8e50-496e-8d1d-05bab0f25bdb-1710869262

2024-03-19T17:27:42.481Z: Sending "Partners" GraphQL request:
  query activeAppVersion($apiKey: String!) {
    app(apiKey: $apiKey) {
      activeAppVersion {
        appModuleVersions {
          registrationId
          registrationUuid
          registrationTitle
          type
          config
          specification {
            identifier
            name
            experience
            options {
              managementExperience
            }
          }
        }
      }
    }
  }

With variables:
{
  "apiKey": "*****"
}

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

2024-03-19T17:27:43.195Z: Request to https://partners.shopify.com/api/cli/graphql completed in 711 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"fae70996ae3117c5e8b1e55a2778292b"
 - x-request-id: 62bf20e2-f08e-48ab-b847-aa48a2b553ad-1710869262

2024-03-19T17:27:43.204Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-19T17:27:43.204Z: Reading the content of file at shopify.app.toml...
2024-03-19T17:27:43.206Z: Reading the content of file at shopify.app.toml...
2024-03-19T17:27:43.209Z: Reading the content of file at shopify.app.demo.toml...
2024-03-19T17:27:43.209Z: Reading the content of file at shopify.app.demo2.toml...
2024-03-19T17:27:43.209Z: Reading the content of file at shopify.app.demo3.toml...
2024-03-19T17:27:43.209Z: Reading the content of file at shopify.app.demo4.toml...
2024-03-19T17:27:43.209Z: Reading the content of file at shopify.app.local.example.toml...
2024-03-19T17:27:43.210Z: Reading the content of file at shopify.app.local.toml...
2024-03-19T17:27:43.210Z: Reading the content of file at shopify.app.prod.toml...
2024-03-19T17:27:43.210Z: Reading the content of file at shopify.app.stage.toml...
2024-03-19T17:27:43.210Z: Reading the content of file at shopify.app.toml...
2024-03-19T17:27:43.278Z: Reading the .env file at .env
2024-03-19T17:27:43.278Z: Reading the content of file at .env...
2024-03-19T17:27:43.287Z: Reading the content of file at extensions/impact-offer/shopify.theme.extension.toml...
2024-03-19T17:27:43.289Z: Reading the content of file at package.json...
2024-03-19T17:27:43.289Z: Reading the content of file at package.json...
2024-03-19T17:27:43.290Z: Obtaining the dependency manager in directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-19T17:27:43.313Z: Reading the content of file at web/shopify.web.toml...
2024-03-19T17:27:43.417Z: Reading the content of file at package.json...
2024-03-19T17:27:43.420Z: File-writing some content to file at shopify.app.toml...
╭─ info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                               │
│  Using shopify.app.toml:                                                                                                      │
│                                                                                                                               │
│    • Org:             Inspired                                                                                                │
│    • App:             Mike Dev 2                                                                                              │
│    • Dev store:       mike-dev-20240307.myshopify.com                                                                         │
│    • Update URLs:     Yes                                                                                                     │
│                                                                                                                               │
│   You can pass `--reset` to your command to reset your app configuration.                                                     │
│                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭─ error ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                               │
│  Port 3457 is not available for serving GraphiQL.                                                                             │
│                                                                                                                               │
│  Choose a different port by setting the `--graphiql-port` flag.                                                               │
│                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

2024-03-19T17:27:43.735Z: Obtaining the dependency manager in directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-19T17:27:43.740Z: 
Running system process:
  · Command: ruby -v
  · Working directory: /Users/mikefortney/Code/inspired-shopify-app

2024-03-19T17:27:44.073Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 184 ms
With response headers:
 - x-request-id: 14035460-cb27-4053-8236-9569867641f0

2024-03-19T17:27:44.073Z: Analytics event sent: {
  "command": "app dev",
  "time_start": 1710869258714,
  "time_end": 1710869263728,
  "total_time": 5014,
  "success": false,
  "cli_version": "3.57.1",
  "ruby_version": "3.1.2",
  "node_version": "18.16.0",
  "is_employee": false,
  "uname": "darwin 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\"]",
  "env_shell": "zsh",
  "env_device_id": "931edb539b543f21964c98554b369692d97e6f9a",
  "env_cloud": "localhost",
  "env_package_manager": "yarn",
  "cmd_app_warning_api_key_deprecation_displayed": false,
  "cmd_app_all_configs_any": true,
  "cmd_app_all_configs_clients": "{\"shopify.app.demo.toml\":\"f640c5379e21bd8378ef6dd6aaf176de\",\"shopify.app.demo2.toml\":\"73b461ccce67ed8a3260247a3beff66f\",\"shopify.app.demo3.toml\":\"541436c4404bf3f0e54b4d34816d259b\",\"shopify.app.demo4.toml\":\"a53bd83584de633a53b8f1e92500a00e\",\"shopify.app.local.example.toml\":\"9c5b31a27198c251f45833eccaf177e1\",\"shopify.app.local.toml\":\"30f4c3840d2735869db42dfd7b1214f2\",\"shopify.app.prod.toml\":\"156f1bcff82a9a207126d5f1ce2292e3\",\"shopify.app.stage.toml\":\"9c5b31a27198c251f45833eccaf177e1\",\"shopify.app.toml\":\"549dee2476c0f03fee6e83b6cb4aa43b\"}",
  "cmd_app_linked_config_used": true,
  "cmd_app_linked_config_name": "shopify.app.toml",
  "cmd_app_linked_config_git_tracked": true,
  "cmd_app_linked_config_source": "cached",
  "cmd_app_linked_config_uses_cli_managed_urls": true,
  "partner_id": 1964153,
  "api_key": "549dee2476c0f03fee6e83b6cb4aa43b",
  "project_type": "frontend",
  "app_extensions_any": true,
  "app_extensions_breakdown": "{\"theme\":1}",
  "app_extensions_count": 1,
  "app_extensions_custom_layout": false,
  "app_extensions_function_any": false,
  "app_extensions_function_count": 0,
  "app_extensions_theme_any": true,
  "app_extensions_theme_count": 1,
  "app_extensions_ui_any": false,
  "app_extensions_ui_count": 0,
  "app_name_hash": "03c43754d385fe8179715f253d2e3828998b4fb6",
  "app_path_hash": "e95e5966e8c33cbcc0ec24af48ed39f8c4f64306",
  "app_scopes": "[\"read_orders\",\"read_products\",\"read_script_tags\",\"read_themes\",\"write_script_tags\"]",
  "app_web_backend_any": false,
  "app_web_backend_count": 0,
  "app_web_custom_layout": false,
  "app_web_frontend_any": true,
  "app_web_frontend_count": 1,
  "env_package_manager_workspaces": true,
  "cmd_all_timing_network_ms": 4281,
  "cmd_all_timing_prompts_ms": 0,
  "cmd_all_launcher": "yarn",
  "cmd_all_topic": "app",
  "cmd_all_plugin": "@shopify/app",
  "cmd_all_verbose": true,
  "cmd_all_path_override": true,
  "cmd_all_path_override_hash": "e95e5966e8c33cbcc0ec24af48ed39f8c4f64306",
  "cmd_app_dependency_installation_skipped": false,
  "cmd_app_reset_used": false,
  "cmd_dev_tunnel_type": "custom",
  "cmd_all_timing_active_ms": 732,
  "cmd_all_exit": "expected_error",
  "args": "--tunnel-url https://mf777.pagekite.me:8081 --verbose",
  "error_message": "Port 3457 is not available for serving GraphiQL.",
  "app_name": "inspired-impact-experience",
  "env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2024-03-19T17:27:44.080Z: Reporting handled error to Bugsnag: Port 3457 is not available for serving GraphiQL.
2024-03-19T17:27:44.096Z: Obtaining the dependency manager in directory /Users/mikefortney/Code/inspired-shopify-app...

Reproduction steps

  1. Using a MacOS computer, create new shopify app using the CLI or open existing shopify app that uses versions of @shopify/cli and @shopify/app <= 3.52.0.
  2. Use local package manager to update the cli and app package versions to at least 3.53.0.
  3. Run the shopify app dev command using your local package manager.

Operating System

Mac OS Sonoma 14.4

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

= 3.53.0

Shell

zsh

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

v20.11.1

What language and version are you using in your application?

Node v20.11.1, NextJS v13.0.3, React v18.2.0

gonzaloriestra commented 5 months ago

👋 Thanks for opening the issue.

Unfortunately, I'm not able to reproduce it. Some questions:

mikefortney commented 5 months ago

Hello! It is happening with the latest CLI version, on both an intel based Mac, and an M1 based Mac. I have checked using lsof and none of the ports I’ve tried to use are in use. Here is the verbose output of the dev command with port 5555. Additionally, I used the logout command first so you can see in the output that a message is shown that I have to kill a port in order to login, so I wonder if it is something similar...

➜  inspired-shopify-app git:(mf-test-20241315) ✗ yarn dev --graphiql-port 5555  --verbose
2024-03-20T16:05:10.352Z: Running command app dev
2024-03-20T16:05:10.361Z: Getting a random port...
2024-03-20T16:05:10.366Z: Random port obtained: 53473
2024-03-20T16:05:10.367Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]

2024-03-20T16:05:10.368Z: Getting session store...
2024-03-20T16:05:10.369Z: 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",
  "https://api.shopify.com/auth/destinations.readonly"
]
For applications:
{
  "partnersApi": {
    "scopes": []
  }
}

2024-03-20T16:05:10.369Z: Initiating the full authentication flow...
2024-03-20T16:05:10.370Z: Authorizing through Identity's website...
?  Authentication requires a port 3456 that's unavailable because it's running another process. Terminate that process?
✔  Yes, terminate process in order to log in now

To run this command, log in to Shopify Partners.
👉 Press any key to open the login page on your browser

Auto-open timed out. Open the login page: Log in to Shopify Partners

2024-03-20T16:05:43.727Z: Reading the content of file at ***@***.***/cli-kit/assets/success.html...
2024-03-20T16:05:44.099Z: Reading the content of file at ***@***.***/cli-kit/assets/style.css...
2024-03-20T16:05:44.231Z: Authorization code received. Exchanging it for a CLI token...
2024-03-20T16:05:44.232Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=authorization_code&code=aEdHQlJueWZWSGx1dllzeU0vRkcyNFpLL1Byb0U5UmhhM0E5UFV3R2F4RXAzY2xzZXJtMm5KSGxqSTNqbHdGRm0zU1VpZzQrRmt5VU83b3o4d0NDUUNBRiszTCtuWTQ1aEdWL3lMUjhNZERBZUVqa21QeWpnRGpmbU5zOW5iMzEzVzNUOHNaV2RFL1dWVGhzWCthRDZYaldjWmxndkFEOFZadGpkdkJyaW8yMG1JN1Nqdy9vMXVZdGI2VVNqeTZhVDU5N2pIZFArdjgwS3pwRlZtM2hjeFJ0eGozMFVlemU2RHFHcGtZbUt0RjdjdnhaYkxJc0dvaDFKNVY0TE55MmtZNDIvSE1GY25OL244YURycUpaeHpnMkMyRFBZWld3OFA2dzNnOWEwZk1iNjZucEY4OWZvQ3BQcTRlNXg4UWt1OWVMMmFkaWF3PT0tLXJlSmg0MGxUbWFjaDJuSnItLUZZNW00VFNQR1MxNVJvazlsUGVCbFE9PQ&redirect_uri=http%3A%2F%2F127.0.0.1%3A3456&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&code_verifier=bYrfKFX5VipI1DYtPrSVSKM50rf28c2ExnpGdYyR6zA
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-20T16:05:44.327Z: Reading the content of file at ***@***.***/cli-kit/assets/favicon.svg...
2024-03-20T16:05:44.659Z: Request to https://accounts.shopify.com/oauth/token?grant_type=authorization_code&code=aEdHQlJueWZWSGx1dllzeU0vRkcyNFpLL1Byb0U5UmhhM0E5UFV3R2F4RXAzY2xzZXJtMm5KSGxqSTNqbHdGRm0zU1VpZzQrRmt5VU83b3o4d0NDUUNBRiszTCtuWTQ1aEdWL3lMUjhNZERBZUVqa21QeWpnRGpmbU5zOW5iMzEzVzNUOHNaV2RFL1dWVGhzWCthRDZYaldjWmxndkFEOFZadGpkdkJyaW8yMG1JN1Nqdy9vMXVZdGI2VVNqeTZhVDU5N2pIZFArdjgwS3pwRlZtM2hjeFJ0eGozMFVlemU2RHFHcGtZbUt0RjdjdnhaYkxJc0dvaDFKNVY0TE55MmtZNDIvSE1GY25OL244YURycUpaeHpnMkMyRFBZWld3OFA2dzNnOWEwZk1iNjZucEY4OWZvQ3BQcTRlNXg4UWt1OWVMMmFkaWF3PT0tLXJlSmg0MGxUbWFjaDJuSnItLUZZNW00VFNQR1MxNVJvazlsUGVCbFE9PQ&redirect_uri=http%3A%2F%2F127.0.0.1%3A3456&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&code_verifier=bYrfKFX5VipI1DYtPrSVSKM50rf28c2ExnpGdYyR6zA completed in 420 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/"481bd58da5005414d23473b126b4e185"
 - x-request-id: 999a6f22-03fb-4249-b150-624cf5999329-1710950744

2024-03-20T16:05:44.662Z: CLI token received. Exchanging it for application tokens...
2024-03-20T16:05:44.664Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-20T16:05:44.664Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-20T16:05:44.664Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.57.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

2024-03-20T16:05:44.943Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=**** completed in 278 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/"7a81399b97fb2c68009be3ed8fdb40dd"
 - x-request-id: 0ad84355-d075-4121-823d-cf25d10a5a2a-1710950744

2024-03-20T16:05:44.945Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=**** completed in 277 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/"7f728b250d41ca96a7f56280117a35eb"
 - x-request-id: 6118ebea-f7d5-4bff-aae1-b4768824a3f4-1710950744

2024-03-20T16:05:44.948Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=**** completed in 281 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/"3b79a35689b54afdab913d31214ef8b1"
 - x-request-id: 4ec43823-117e-4d7a-8dba-dad412ffbaa0-1710950744

✔ Logged in.
2024-03-20T16:05:44.949Z: Setting session store...
2024-03-20T16:05:44.973Z: Verifying that the user has a Partner organization
2024-03-20T16:05:44.979Z: Sending "Partners" GraphQL request:
  {
    organizations(first: 1) {
      nodes {
        id
      }
    }
  }

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

2024-03-20T16:05:45.232Z: Reading the content of file at ***@***.***/cli-kit/assets/favicon.svg...
2024-03-20T16:05:45.257Z: Reading the content of file at ***@***.***/cli-kit/assets/favicon.svg...
2024-03-20T16:05:45.283Z: Request to https://partners.shopify.com/api/cli/graphql completed in 290 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"5e2fc688801cd6ac59f4782d82e17e45"
 - x-request-id: af4d9f43-f850-495d-92c7-c7931f954d07-1710950745

2024-03-20T16:05:45.289Z: Sending "Partners" GraphQL request:
  query currentAccountInfo {
    currentAccountInfo {
      __typename
      ... on ServiceAccount {
        orgName
      }
      ... on UserAccount {
        email
      }
    }
  }

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

2024-03-20T16:05:46.141Z: Request to https://partners.shopify.com/api/cli/graphql completed in 850 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"779bdb3bdf728cbb700f66f54e318b79"
 - x-request-id: 22f5d4cc-6361-4a12-93cd-d66c3c71e35b-1710950745

2024-03-20T16:05:46.144Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-20T16:05:46.161Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-20T16:05:46.167Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-20T16:05:46.170Z: Reading the content of file at shopify.app.toml...
2024-03-20T16:05:46.178Z: Reading the content of file at shopify.app.toml...
2024-03-20T16:05:46.268Z: Reading the content of file at shopify.app.demo.toml...
2024-03-20T16:05:46.268Z: Reading the content of file at shopify.app.demo2.toml...
2024-03-20T16:05:46.268Z: Reading the content of file at shopify.app.demo3.toml...
2024-03-20T16:05:46.269Z: Reading the content of file at shopify.app.demo4.toml...
2024-03-20T16:05:46.269Z: Reading the content of file at shopify.app.local.toml...
2024-03-20T16:05:46.269Z: Reading the content of file at shopify.app.local.example.toml...
2024-03-20T16:05:46.270Z: Reading the content of file at shopify.app.prod.toml...
2024-03-20T16:05:46.270Z: Reading the content of file at shopify.app.stage.toml...
2024-03-20T16:05:46.270Z: Reading the content of file at shopify.app.toml...
2024-03-20T16:05:46.375Z: Sending "Partners" GraphQL request:
  query FindApp($apiKey: String!) {
    app(apiKey: $apiKey) {
      id
      title
      apiKey
      organizationId
      apiSecretKeys {
        secret
      }
      appType
      grantedScopes
      developmentStorePreviewEnabled
      disabledBetas
    }
  }

With variables:
{
  "apiKey": "*****"
}

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

2024-03-20T16:05:47.048Z: Request to https://partners.shopify.com/api/cli/graphql completed in 670 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"73e9eed050dd033fe08002cd88700ab1"
 - x-request-id: 4aacf45e-1d3e-49bb-a041-5b76aabbca14-1710950746

2024-03-20T16:05:47.054Z: Sending "Partners" GraphQL request:
  query FindOrganization($id: ID!) {
    organizations(id: $id, first: 1) {
      nodes {
        id
        businessName
        website
      }
    }
  }

With variables:
{
  "id": "1964153"
}

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

2024-03-20T16:05:47.318Z: Request to https://partners.shopify.com/api/cli/graphql completed in 260 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"7377122911fe733fe3a57840b614b221"
 - x-request-id: fdb07e39-6573-42b3-8076-066f00dd58f4-1710950747

2024-03-20T16:05:47.324Z: Sending "Partners" GraphQL request:
  query FindOrganization($id: ID!, $shopDomain: String) {
    organizations(id: $id, first: 1) {
      nodes {
        id
        businessName
        website
        stores(shopDomain: $shopDomain, first: 1, archived: false) {
          nodes {
            shopId
            link
            shopDomain
            shopName
            transferDisabled
            convertableToPartnerTest
          }
        }
      }
    }
  }

With variables:
{
  "id": "1964153",
  "shopDomain": "mike-dev-20240307.myshopify.com"
}

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

2024-03-20T16:05:47.894Z: Request to https://partners.shopify.com/api/cli/graphql completed in 568 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"19dc62446398e310105635298dfb8679"
 - x-request-id: f7c4b698-59dd-4911-b226-1a34d8fd6b36-1710950747

2024-03-20T16:05:47.898Z: Sending "Partners" GraphQL request:
  query fetchSpecifications($api_key: String!) {
    extensionSpecifications(apiKey: $api_key) {
      name
      externalName
      externalIdentifier
      identifier
      gated
      experience
      options {
        managementExperience
        registrationLimit
      }
      features {
        argo {
          surface
        }
      }
    }
  }

With variables:
{
  "api_key": "549dee2476c0f03fee6e83b6cb4aa43b"
}

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

2024-03-20T16:05:48.215Z: Request to https://partners.shopify.com/api/cli/graphql completed in 314 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"5ea9431c2b39b2d9003ebb8a8f3ea447"
 - x-request-id: 228d62e3-9e9b-437b-aecd-5b20d1d0a431-1710950748

2024-03-20T16:05:48.220Z: Sending "Partners" GraphQL request:
  query activeAppVersion($apiKey: String!) {
    app(apiKey: $apiKey) {
      activeAppVersion {
        appModuleVersions {
          registrationId
          registrationUuid
          registrationTitle
          type
          config
          specification {
            identifier
            name
            experience
            options {
              managementExperience
            }
          }
        }
      }
    }
  }

With variables:
{
  "apiKey": "*****"
}

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

2024-03-20T16:05:48.718Z: Request to https://partners.shopify.com/api/cli/graphql completed in 496 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"fae70996ae3117c5e8b1e55a2778292b"
 - x-request-id: 70f27cc4-0aec-457d-9726-beea2eb424bf-1710950748

2024-03-20T16:05:48.724Z: Reading cached app information for directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-20T16:05:48.724Z: Reading the content of file at shopify.app.toml...
2024-03-20T16:05:48.726Z: Reading the content of file at shopify.app.toml...
2024-03-20T16:05:48.729Z: Reading the content of file at shopify.app.demo.toml...
2024-03-20T16:05:48.729Z: Reading the content of file at shopify.app.demo2.toml...
2024-03-20T16:05:48.729Z: Reading the content of file at shopify.app.demo3.toml...
2024-03-20T16:05:48.729Z: Reading the content of file at shopify.app.local.example.toml...
2024-03-20T16:05:48.730Z: Reading the content of file at shopify.app.demo4.toml...
2024-03-20T16:05:48.731Z: Reading the content of file at shopify.app.local.toml...
2024-03-20T16:05:48.731Z: Reading the content of file at shopify.app.prod.toml...
2024-03-20T16:05:48.731Z: Reading the content of file at shopify.app.stage.toml...
2024-03-20T16:05:48.732Z: Reading the content of file at shopify.app.toml...
2024-03-20T16:05:48.804Z: Reading the .env file at .env
2024-03-20T16:05:48.804Z: Reading the content of file at .env...
2024-03-20T16:05:48.814Z: Reading the content of file at extensions/impact-offer/shopify.theme.extension.toml...
2024-03-20T16:05:48.816Z: Reading the content of file at package.json...
2024-03-20T16:05:48.816Z: Reading the content of file at package.json...
2024-03-20T16:05:48.817Z: Obtaining the dependency manager in directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-20T16:05:48.849Z: Reading the content of file at web/shopify.web.toml...
2024-03-20T16:05:48.939Z: Reading the content of file at package.json...
2024-03-20T16:05:48.944Z: File-writing some content to file at shopify.app.toml...
╭─ info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                   │
│  Using shopify.app.toml:                                                                                                          │
│                                                                                                                                   │
│    • Org:             Inspired                                                                                                    │
│    • App:             Mike Dev 2                                                                                                  │
│    • Dev store:       mike-dev-20240307.myshopify.com                                                                             │
│    • Update URLs:     Yes                                                                                                         │
│                                                                                                                                   │
│   You can pass `--reset` to your command to reset your app configuration.                                                         │
│                                                                                                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭─ error ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                   │
│  Port 5555 is not available for serving GraphiQL.                                                                                 │
│                                                                                                                                   │
│  Choose a different port by setting the `--graphiql-port` flag.                                                                   │
│                                                                                                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

2024-03-20T16:05:48.993Z: Obtaining the dependency manager in directory /Users/mikefortney/Code/inspired-shopify-app...
2024-03-20T16:05:48.996Z: 
Running system process:
  · Command: ruby -v
  · Working directory: /Users/mikefortney/Code/inspired-shopify-app

2024-03-20T16:05:49.316Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 237 ms
With response headers:
 - x-request-id: 380d3f68-1b85-4aa9-8676-596d3f3471f1

2024-03-20T16:05:49.317Z: Analytics event sent: {
  "command": "app dev",
  "time_start": 1710950710353,
  "time_end": 1710950748986,
  "total_time": 38633,
  "success": false,
  "cli_version": "3.57.1",
  "ruby_version": "3.1.2",
  "node_version": "18.16.0",
  "is_employee": false,
  "uname": "darwin amd64",
  "env_ci": false,
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": ***@***.******@***.******@***.******@***.***/plugin-did-you-mean\"]",
  "env_shell": "zsh",
  "env_device_id": "931edb539b543f21964c98554b369692d97e6f9a",
  "env_cloud": "localhost",
  "env_package_manager": "yarn",
  "cmd_app_warning_api_key_deprecation_displayed": false,
  "cmd_app_all_configs_any": true,
  "cmd_app_all_configs_clients": "{\"shopify.app.demo.toml\":\"f640c5379e21bd8378ef6dd6aaf176de\",\"shopify.app.demo2.toml\":\"73b461ccce67ed8a3260247a3beff66f\",\"shopify.app.demo3.toml\":\"541436c4404bf3f0e54b4d34816d259b\",\"shopify.app.demo4.toml\":\"a53bd83584de633a53b8f1e92500a00e\",\"shopify.app.local.example.toml\":\"9c5b31a27198c251f45833eccaf177e1\",\"shopify.app.local.toml\":\"30f4c3840d2735869db42dfd7b1214f2\",\"shopify.app.prod.toml\":\"156f1bcff82a9a207126d5f1ce2292e3\",\"shopify.app.stage.toml\":\"9c5b31a27198c251f45833eccaf177e1\",\"shopify.app.toml\":\"549dee2476c0f03fee6e83b6cb4aa43b\"}",
  "cmd_app_linked_config_used": true,
  "cmd_app_linked_config_name": "shopify.app.toml",
  "cmd_app_linked_config_git_tracked": true,
  "cmd_app_linked_config_source": "cached",
  "cmd_app_linked_config_uses_cli_managed_urls": true,
  "partner_id": 1964153,
  "api_key": "549dee2476c0f03fee6e83b6cb4aa43b",
  "project_type": "frontend",
  "app_extensions_any": true,
  "app_extensions_breakdown": "{\"theme\":1}",
  "app_extensions_count": 1,
  "app_extensions_custom_layout": false,
  "app_extensions_function_any": false,
  "app_extensions_function_count": 0,
  "app_extensions_theme_any": true,
  "app_extensions_theme_count": 1,
  "app_extensions_ui_any": false,
  "app_extensions_ui_count": 0,
  "app_name_hash": "03c43754d385fe8179715f253d2e3828998b4fb6",
  "app_path_hash": "e95e5966e8c33cbcc0ec24af48ed39f8c4f64306",
  "app_scopes": "[\"read_orders\",\"read_products\",\"read_script_tags\",\"read_themes\",\"write_script_tags\"]",
  "app_web_backend_any": false,
  "app_web_backend_count": 0,
  "app_web_custom_layout": false,
  "app_web_frontend_any": true,
  "app_web_frontend_count": 1,
  "env_package_manager_workspaces": true,
  "cmd_all_timing_network_ms": 4184,
  "cmd_all_timing_prompts_ms": 33538,
  "cmd_all_launcher": "yarn",
  "cmd_all_topic": "app",
  "cmd_all_plugin": ***@***.***/app",
  "cmd_all_verbose": true,
  "cmd_all_path_override": true,
  "cmd_all_path_override_hash": "e95e5966e8c33cbcc0ec24af48ed39f8c4f64306",
  "cmd_app_dependency_installation_skipped": false,
  "cmd_app_reset_used": false,
  "cmd_dev_tunnel_type": "custom",
  "cmd_all_timing_active_ms": 909,
  "cmd_all_exit": "expected_error",
  "args": "--tunnel-url https://mf777.pagekite.me:8081 --graphiql-port 5555 --verbose",
  "error_message": "Port 5555 is not available for serving GraphiQL.",
  "app_name": "inspired-impact-experience",
  "env_plugin_installed_all": ***@***.******@***.******@***.******@***.***/plugin-did-you-mean\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2024-03-20T16:05:49.322Z: Reporting handled error to Bugsnag: Port 5555 is not available for serving GraphiQL.
2024-03-20T16:05:49.338Z: Obtaining the dependency manager in directory /Users/mikefortney/Code/inspired-shopify-app…

Thank you! Mike

On Mar 20, 2024, at 2:52 AM, Gonzalo Riestra @.***> wrote:

👋 Thanks for opening the issue.

Unfortunately, I'm not able to reproduce it. Some questions:

Does it happen with the latest CLI version (3.57.1)? Could you run lsof -i:3457 to check if the default port is in use? Could you share the verbose log of yarn dev --graphiql-port 5555 --verbose? — Reply to this email directly, view it on GitHub https://github.com/Shopify/cli/issues/3578#issuecomment-2009158167, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHNLIHXIBEX2E2RLPN3U5DYZFL43AVCNFSM6AAAAABE6CYGJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBZGE2TQMJWG4. You are receiving this because you authored the thread.

gonzaloriestra commented 5 months ago

The issue with the port while trying to log in is revealing. There must be something weird in your environment.

Two more questions:

gonzaloriestra commented 5 months ago

One more test: could you try changing the version of the @shopify/cli and @shopify/app dependencies from your package.json to 0.0.0-experimental-20240321094046 and running install with your package manager? That version uses a random port for GraphiQL when the default one is not available (from this PR).

mikefortney commented 5 months ago

@gonzaloriestra the dev script is defined in my package.json as shopify app dev --tunnel-url $(grep TUNNEL_URL .env | cut -d '=' -f2) so our team of devs can all have their own local tunnel url. Today I will test with a fresh new app, and also using the dependency version you referenced. I will report back later today!

mikefortney commented 5 months ago

@gonzaloriestra I tried with a fresh app, and it works just fine... I've tried the experimental dependency versions in my existing app but still had the same issue with the random port. So it must be something missing/conflicting in my local app. It is a NextJS app, not Remix. I've been dragging my feet refactoring to remix. I can replicate this issue in my repo on two computers, so I'm guessing it must be an issue with my app. I will continue to use the 3.52.0 dependency versions for the moment until I refactor using the latest app template. You can close this issue. Thank you so much for your help!

ozziexsh commented 3 months ago

We just ran into this and spent a ton of time debugging it. For anyone coming from google in the future, this is what the problem was for us:

https://github.com/unjs/get-port-please/blob/main/src/get-port.ts#L150

the function used to check ports defaults to looking on the hostname set at process.env.HOST which we were using in our app through a .env file for something unrelated which was causing conflicts (it was set to something like HOST=http://localhost/)

removing the HOST= from our environment solved this and had everything working

mikefortney commented 3 months ago

We just ran into this and spent a ton of time debugging it. For anyone coming from google in the future, this is what the problem was for us:

https://github.com/unjs/get-port-please/blob/main/src/get-port.ts#L150

the function used to check ports defaults to looking on the hostname set at process.env.HOST which we were using in our app through a .env file for something unrelated which was causing conflicts (it was set to something like HOST=http://localhost/)

removing the HOST= from our environment solved this and had everything working

OMG this totally fixed it!! @gonzaloriestra please add this note (or similar) to the CLI documentation: "You must not have a value for HOST in your local .env file in order for the local GraphiQL server to function. Please change the name of that environment variable to something like APP_HOST instead."

This also solved the issue I mentioned (in a comment above) that the CLI had an issue with the port for logging in as well!