A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
I am a developer, and we use a local ruby app with the shopify gem (version 9.0.2)
Evrything worked well, until recently (around Monday-Tuesday), when suddenly it can't parse all my GraphQL call on Heroku
But when I am doing the same process locally, it works
For example, on both :
-I am initializing the ShopifyAPI with the credentials, the api_version
- I ask the following request
query_variables = {'gid' => gid} query_str = <<-'GRAPHQL' query($gid: ID!) { product(id: $gid) { id handle title productType publishedAt tags updatedAt status vendor onlineStoreUrl isGiftCard } } GRAPHQL
-After that I initialize the client :
client = ShopifyAPI::GraphQL.client
- And then I try to parse
query_graph_ql = client.parse(query_str)
Locally it works well, and now on Heroku I have this error
NoMethodError (undefined method `fields' for nil:NilClass)
and before a few days ago, it worked well on Heroku as well
Does someone has an idea where does this error comes from ?
Solved! Go to the solution
This is an accepted solution.
The error was due to an update of the graphql-client gem
This gem has been updated this year, the version before was from 2022
The shopify gem version I use (9.0.2), use the last version of graphql-client and it's incompatible with this version of the shopify gem
I forced the previous version in my Gemfile and now it is working again
Hi Bseido,
Have you made any changes on the Shopify side or Heroku recently? It does seem to be an issue on the hosting side.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi Liam,
Yes I made change on Shopify, the store is now multlingual
But from my POV, it shouldn't work on local either, if it comes from Shopify
So I suppose it comes from something on Heroku, however when I am using the console on heroku, the only problem is with GraphQL (and I have push the API Version I am using on it)
Edit: I tried on others Shop i own and the result is the same
I also want to note that it works well with the REST API, it is really only the GraphQL one
And I am initializing (with the api key and password) the same way for both
For heroku, it seems to have appeared after a push
But until now, I have always use the same method for pushing, and it has always worked
So I don't know why it appeared now
Hi Liam,
I have tested on several shop and the GraphQL does not work
I have also fixed some problems I had with Herok and tried to generate again the graphql:dump and push it
But I still have the same problem, only with GraphQL
From my understanding of the error, it's as if the "client" is not correctly initialize
Is there a way to do a GraphQL request without using the parse ? Or do you have an example of a request after the parse ?
I would like to test if the client.query method works
For now my only conclusion would be that something has not been correctly push on Heroku, since on local it's working, but I don't know what it is
And why would it impact only GraphQL, and not the REST API (I initialize both the exact same way)
It's really troublesome and right now it does not make much sense to me...
This is an accepted solution.
The error was due to an update of the graphql-client gem
This gem has been updated this year, the version before was from 2022
The shopify gem version I use (9.0.2), use the last version of graphql-client and it's incompatible with this version of the shopify gem
I forced the previous version in my Gemfile and now it is working again