Shopify / cli

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

[Bug]: Error when previewing theme app extension via Shopify CLI #3265

Closed gcaramori closed 8 months ago

gcaramori commented 9 months ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

App, Extension

Expected behavior

It should give the preview URL for my theme app extension

Actual behavior

It throws an unintialized constant 'Extension::Models::DevelopmentServerRequirements' error.

issue

Verbose output

2024-01-15T18:36:09.635Z: Running command app dev
2024-01-15T18:36:09.645Z: Getting a random port...
2024-01-15T18:36:09.656Z: Random port obtained: 54413
2024-01-15T18:36:09.675Z: 
Running system process:
  · Command: C:/Projects/performa-shopify-app-final/node_modules/.pnpm/@shopify+plugin-cloudflare@3.53.0_@types+node@20.11.2_@types+react@18.2.48_typescript@5.3.3/node_modules/@shopify/plugin-cloudflare/bin/cloudflared.exe tunnel --url http://localhost:54413 --no-autoupdate
  · Working directory: C:/Projects/performa-shopify-app-final

2024-01-15T18:36:09.679Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]

2024-01-15T18:36:09.680Z: Getting session store...
2024-01-15T18:36:09.683Z: 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-01-15T18:36:09.685Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2024-01-15T18:36:09.686Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
 - User-Agent: Shopify CLI; v=3.53.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2024-01-15T18:36:09.702Z: 2024-01-15T18:36:09Z INF Thank you for trying Cloudflare Tunnel. Doing so, without a Cloudflare account, is a quick way to experiment and try it out. However, be aware that these account-less Tunnels have no uptime guarantee. If you intend to use Tunnels in production you should use a pre-created named tunnel by following: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
2024-01-15T18:36:09Z INF Requesting new quick Tunnel on trycloudflare.com...

2024-01-15T18:36:10.057Z: Request to https://accounts.shopify.com/oauth/introspection completed in 365 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/"c1ce0e39d2a94a496d168dfe66371a22"
 - x-request-id: 740b6a7e-24e1-4fa1-802b-0c4098de8130

2024-01-15T18:36:10.062Z: The identity token is valid: true
2024-01-15T18:36:10.062Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false

2024-01-15T18:36:10.063Z: Verifying that the user has a Partner organization
2024-01-15T18:36:10.092Z: Sending "Partners" GraphQL request:
  {
    organizations(first: 1) {
      nodes {
        id
      }
    }
  }

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

2024-01-15T18:36:10.386Z: Request to https://partners.shopify.com/api/cli/graphql completed in 281 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"ce64b5c9f60cbb40301e649893624c15"
 - x-request-id: cfaa7015-ff99-42b1-a960-ea8c983598df

2024-01-15T18:36:10.407Z: Sending "Partners" GraphQL request:
  query currentAccountInfo {
    currentAccountInfo {
      __typename
      ... on ServiceAccount {
        orgName
      }
      ... on UserAccount {
        email
      }
    }
  }

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

2024-01-15T18:36:10.683Z: 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/"eae5f98a7576939678cd2aa034cba844"
 - x-request-id: 99541d8f-550a-4b0a-ba3d-768023d47d68

2024-01-15T18:36:10.692Z: Reading cached app information for directory C:/Projects/performa-shopify-app-final...
2024-01-15T18:36:10.714Z: Reading cached app information for directory C:/Projects/performa-shopify-app-final...
2024-01-15T18:36:10.719Z: Reading cached app information for directory C:/Projects/performa-shopify-app-final...
2024-01-15T18:36:10.720Z: Reading the content of file at shopify.app.toml...
2024-01-15T18:36:10.723Z: Reading the content of file at shopify.app.toml...
2024-01-15T18:36:10.728Z: Reading the content of file at shopify.app.toml...
2024-01-15T18:36:10.862Z: Sending "Partners" GraphQL request:
  query FindApp($apiKey: String!) {
    app(apiKey: $apiKey) {
      id
      title
      apiKey
      organizationId
      apiSecretKeys {
        secret
      }
      appType
      grantedScopes
      applicationUrl
      redirectUrlWhitelist
      requestedAccessScopes
      webhookApiVersion
      embedded
      posEmbedded
      preferencesUrl
      gdprWebhooks {
        customerDeletionUrl
        customerDataRequestUrl
        shopDeletionUrl
      }
      appProxy {
        subPath
        subPathPrefix
        url
      }
      developmentStorePreviewEnabled
    }
  }

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

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

2024-01-15T18:36:10.934Z: 2024-01-15T18:36:10Z INF +--------------------------------------------------------------------------------------------+
2024-01-15T18:36:10Z INF |  Your quick Tunnel has been created! Visit it at (it may take some time to be reachable):  |
2024-01-15T18:36:10Z INF |  https://mongolia-neutral-rod-filtering.trycloudflare.com                                  |
2024-01-15T18:36:10Z INF +--------------------------------------------------------------------------------------------+

2024-01-15T18:36:10.936Z: 2024-01-15T18:36:10Z INF Cannot determine default configuration path. No file [config.yml config.yaml] in [~/.cloudflared ~/.cloudflare-warp ~/cloudflare-warp]
2024-01-15T18:36:10Z INF Version 2023.5.1
2024-01-15T18:36:10Z INF GOOS: windows, GOVersion: go1.19, GoArch: amd64
2024-01-15T18:36:10Z INF Settings: map[ha-connections:1 no-autoupdate:true protocol:quic url:http://localhost:54413]
2024-01-15T18:36:10Z INF cloudflared will not automatically update on Windows systems.
2024-01-15T18:36:10Z INF Generated Connector ID: 7c2825df-6aec-4b2d-8c4d-0a20dd6b7341

2024-01-15T18:36:10.947Z: 2024-01-15T18:36:10Z INF Initial protocol quic

2024-01-15T18:36:10.947Z: 2024-01-15T18:36:10Z INF ICMP proxy will use 192.168.15.85 as source for IPv4

2024-01-15T18:36:10.957Z: 2024-01-15T18:36:10Z INF ICMP proxy will use 2804:431:c7f0:7ea1:19c5:30c5:6c3b:9c02 in zone Ethernet as source for IPv6

2024-01-15T18:36:10.975Z: 2024-01-15T18:36:10Z INF cloudflared does not support loading the system root certificate pool on Windows. Please use --origin-ca-pool <PATH> to specify the path to the certificate pool

2024-01-15T18:36:10.976Z: 2024-01-15T18:36:10Z INF Starting metrics server on 127.0.0.1:54420/metrics

2024-01-15T18:36:11.296Z: 2024-01-15T18:36:11Z INF Registered tunnel connection connIndex=0 connection=9ba61b45-df4a-4981-a0ec-5b3d9b6df267 event=0 ip=198.41.192.167 location=scl01 protocol=quic

2024-01-15T18:36:11.823Z: Request to https://partners.shopify.com/api/cli/graphql completed in 956 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"4ad68fb5fa94d8afda4f1cfb124141cb"
 - x-request-id: 8f4c210a-d8e9-465d-bca3-38570965594d

2024-01-15T18:36:11.883Z: Sending "Partners" GraphQL request:
  query FindOrganization($id: ID!) {
    organizations(id: $id, first: 1) {
      nodes {
        id
        businessName
        website
      }
    }
  }

With variables:
{
  "id": "1805640"
}

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

2024-01-15T18:36:12.141Z: Request to https://partners.shopify.com/api/cli/graphql completed in 254 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"046272f6c6fe8799fa4c81236e31be94"
 - x-request-id: 57180f80-9d84-4c5c-b8a6-c273a6c15935

2024-01-15T18:36:12.183Z: 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": "1805640",
  "shopDomain": "performa3.myshopify.com"
}

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

2024-01-15T18:36:12.518Z: Request to https://partners.shopify.com/api/cli/graphql completed in 331 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"66c7f963b4cc77adfaab4bc2e4a0efbf"
 - x-request-id: aba0268e-7ab4-40ad-a622-c8e94de60520

2024-01-15T18:36:12.527Z: File-writing some content to file at shopify.app.toml...
╭─ info ──────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                 │
│  Using shopify.app.toml:                                                                        │
│                                                                                                 │
│    • Org:          Performa.ai                                                                  │
│    • App:          Power Display - Performa.AI                                                  │
│    • Dev store:    performa3.myshopify.com                                                      │
│    • Update URLs:  Yes                                                                          │
│                                                                                                 │
│   You can pass `--reset` to your command to reset your app configuration.                       │
│                                                                                                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────╯

2024-01-15T18:36:12.589Z: 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": "ebfe87d147dc60a1673df27d5ad156f6"
}

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

2024-01-15T18:36:12.638Z: 2024-01-15T18:36:12Z WRN Your version 2023.5.1 is outdated. We recommend upgrading it to 2024.1.2

2024-01-15T18:36:12.920Z: Request to https://partners.shopify.com/api/cli/graphql completed in 327 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"cddaf6752a4b1db74c7aeedd3e1dbe40"
 - x-request-id: 1cd992bd-f5f2-489e-b748-943fd7b78604

2024-01-15T18:36:12.982Z: Reading cached app information for directory C:/Projects/performa-shopify-app-final...
2024-01-15T18:36:12.983Z: Reading the content of file at shopify.app.toml...
2024-01-15T18:36:12.985Z: Reading the content of file at shopify.app.toml...
2024-01-15T18:36:12.987Z: Reading the content of file at shopify.app.toml...
2024-01-15T18:36:13.087Z: Reading the .env file at .env
2024-01-15T18:36:13.088Z: Reading the content of file at .env...
2024-01-15T18:36:13.098Z: Reading the content of file at extensions/power-display/shopify.extension.toml...
2024-01-15T18:36:13.100Z: Reading the content of file at package.json...
2024-01-15T18:36:13.101Z: Reading the content of file at package.json...
2024-01-15T18:36:13.103Z: Obtaining the dependency manager in directory C:/Projects/performa-shopify-app-final...
2024-01-15T18:36:13.120Z: Reading the content of file at shopify.web.toml...
2024-01-15T18:36:13.124Z: Reading the content of file at package.json...
2024-01-15T18:36:13.136Z: Polling tunnel status for cloudflare (attempt 0): connected
2024-01-15T18:36:13.137Z: Getting a random port...
2024-01-15T18:36:13.139Z: Random port obtained: 54427
2024-01-15T18:36:13.164Z: Sending "Partners" GraphQL request:
  query getApp($apiKey: String!) {
    app(apiKey: $apiKey) {
      applicationUrl
      redirectUrlWhitelist
      appProxy {
        url
        subPath
        subPathPrefix
      }
    }
  }

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

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

2024-01-15T18:36:13.783Z: Request to https://partners.shopify.com/api/cli/graphql completed in 615 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"7840cd1ab326269ed650adec4f9050cd"
 - x-request-id: ddff5a58-f0ee-47a4-a62d-261af8ae89ab

2024-01-15T18:36:13.835Z: Sending "Partners" GraphQL request:
  mutation appUpdate($apiKey: String!, $applicationUrl: Url!, $redirectUrlWhitelist: [Url]!, $appProxy: AppProxyInput) {
    appUpdate(
      input: {
        apiKey: $apiKey
        applicationUrl: $applicationUrl
        redirectUrlWhitelist: $redirectUrlWhitelist
        appProxy: $appProxy
      }
    ) {
      userErrors {
        message
        field
      }
    }
  }

With variables:
{
  "apiKey": "*****",
  "applicationUrl": "https://mongolia-neutral-rod-filtering.trycloudflare.com",
  "redirectUrlWhitelist": [
    "https://mongolia-neutral-rod-filtering.trycloudflare.com/auth/callback",
    "https://mongolia-neutral-rod-filtering.trycloudflare.com/auth/shopify/callback",
    "https://mongolia-neutral-rod-filtering.trycloudflare.com/api/auth/callback"
  ]
}

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

2024-01-15T18:36:14.743Z: Request to https://partners.shopify.com/api/cli/graphql completed in 904 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"76acb4e44b91f928c3744a856cacdd2e"
 - x-request-id: 4deda418-daae-4fda-a127-94edb27d0240

2024-01-15T18:36:14.746Z: File-writing some content to file at shopify.app.toml...
2024-01-15T18:36:14.749Z: Getting a random port...
2024-01-15T18:36:14.750Z: Random port obtained: 54430
2024-01-15T18:36:14.752Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store performa3.myshopify.com:
[]

2024-01-15T18:36:14.752Z: Getting session store...
2024-01-15T18:36:14.753Z: 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:
{
  "adminApi": {
    "scopes": [],
    "storeFqdn": "performa3.myshopify.com"
  }
}

2024-01-15T18:36:14.755Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2024-01-15T18:36:14.755Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
 - User-Agent: Shopify CLI; v=3.53.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2024-01-15T18:36:14.982Z: Request to https://accounts.shopify.com/oauth/introspection completed in 224 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/"c1ce0e39d2a94a496d168dfe66371a22"
 - x-request-id: 121950a7-f5bb-4549-927f-9a3045722f47

2024-01-15T18:36:14.984Z: The identity token is valid: true
2024-01-15T18:36:14.985Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false

2024-01-15T18:36:14.985Z: Getting host theme...

Reproduction steps

  1. Clone the Shopify Remix app template (https://github.com/Shopify/shopify-app-template-remix)
  2. After basic setup, run "pnpm shopify app generate extension" and select type "Theme App Extension (Online store)"
  3. Run "pnpm dev" and see the error on console

Operating System

Windows 11

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

3.53.0

Shell

Git bash

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

20.10.0

What language and version are you using in your application?

Ruby 3.33, Node 20.10.0, React 18.2.0

gonzaloriestra commented 9 months ago

@Shopify/theme-code-tools could you please have a look? 🙏

gcaramori commented 9 months ago

I've recreated the app via shopify cli (pnpm create @shopify/app), and now it works properly!

github-actions[bot] commented 8 months ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.