Shopify GraphQL - no schema file exists even though it does

Todd_Trimakas
Shopify Partner
113 0 20

I'm trying to get started with Graphql and Shopify. I am getting the following error:

 

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

 


Even though I've run this rake task:

 

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

 

 

And I can see the file here: https://nimb.ws/ypDVAK and when I run

ShopifyAPI::GraphQL.schema_location

 

I get `#<Pathname:/home/shipping-new/db/shopify_graphql_schemas>`

 

I am only trying to do the following to get the shop name as a test:

 

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

 

 

My Shopify Initializer config file also has the same `api_version` here:

config.api_version = "2021-01"

 

How can I download the schema in order to use GraphQL for Shopify?

ByteStand - Amazon to Shopify in one click