【问题标题】:Shopify GraphQL - no schema file exists even though it doesShopify GraphQL - 即使存在架构文件也不存在
【发布时间】:2021-06-02 13:45:13
【问题描述】:

我正在尝试开始使用 Graphql 和 Shopify。我收到以下错误:

Client for API version 2020-01 does not exist because no schema file exists at `shopify_graphql_schemas/2020-01.json`. (ShopifyAPI::GraphQL::InvalidClient)

即使我已经运行了这个 rake 任务:

rake shopify_api:graphql:dump SHOP_DOMAIN="shipping-inventory-sync.myshopify.com" ACCESS_TOKEN="the_right_token" API_VERSION=2020-01

我可以在这里看到文件:https://nimb.ws/ypDVAK,当我在控制台中运行ShopifyAPI::GraphQL.schema_location 时,我得到#<Pathname:/home/shipping-new/db/shopify_graphql_schemas>

我只是尝试执行以下操作以获取商店名称作为测试:

sesh = ShopifyAPI::Session.new(domain: "shipping-inventory-sync.myshopify.com", token: 'xx', api_version: '2020-01')
ShopifyAPI::Base.activate_session(sesh)

client = ShopifyAPI::GraphQL.client

SHOP_NAME_QUERY = client.parse <<-'GRAPHQL'
  {
    shop {
      name
    }
  }
GRAPHQL

result = client.query(SHOP_NAME_QUERY)
pp result.data.shop.name

我的 Shopify Initializer 配置文件在这里也有相同的 api_version

config.api_version = "2021-01"

如何下​​载架构以使用 GraphQL for Shopify?

【问题讨论】:

    标签: graphql shopify shopify-api


    【解决方案1】:

    您似乎在您的 rake 任务中指定了 api 版本“2020-01”,但在您的初始化程序中您指定了不同的版本。

    【讨论】:

      猜你喜欢
      • 2018-11-16
      • 2022-01-23
      • 2019-08-08
      • 1970-01-01
      • 2015-10-26
      • 2014-02-20
      • 2022-06-12
      • 2018-04-07
      • 2019-11-21
      相关资源
      最近更新 更多