Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem ShopifyAPI::GraphQL.client.parse - undefined method `fields' for nil:NilClass #1278

Closed
Tracked by #1281
bseido opened this issue Feb 9, 2024 · 4 comments
Closed
Tracked by #1281

Comments

@bseido
Copy link

bseido commented Feb 9, 2024

Issue summary

Hi,

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 (local and with "heroku run rails c") : 
-I am initializing the ShopifyAPI with the credentials, the api_version

  • I ask the following request in a method
query_variables = {'gid' => gid}
    query_str = <<-'GRAPHQL'
      query($gid: ID!) {
        product(id: $gid) {
          id
        }
      }
    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

I have push other things (like credentials, or code on other files), but these has no links with the GraphQL
And if those changes were the cause, i don't think it would work locally
Does someone has an idea where does this error comes from ?

Thanks

  • shopify_api version: 9.0.2
  • Ruby version: ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32]
  • Operating system: Windows 10
// Paste any relevant logs here

Expected behavior

The query is parsed correctly

Actual behavior

NoMethodError (undefined method `fields' for nil:NilClass) when trying to parse the GraphQL query, but only on Heroku
Locally it works correctly

Steps to reproduce the problem

I don't really know how to reproduce it

@lizkenyon
Copy link
Contributor

Hi there 👋

If you would like us to look into this issue could you provide us with a minimal repository we can deploy to Heroku that reproduce the issue?

@bseido
Copy link
Author

bseido commented Feb 15, 2024

Hi ! Thanks for your answer

My app is pretty big and I don't know how I could really do a minimal version without spending a huge amount of time on it (and sadly, I don't have the time to do it)
I can try to create one but I don't know when it will be ready

I want to point out that I have some problems with Heroku (no possibilities to push, clone, etc, it always return a 504 error, and some memory problem i didn't have before either), so I am wondering it the problem could come from Heroku itself, since the gem is working correctly locally

I have submitted a ticket to them, but I have no answers at this time

@lizkenyon
Copy link
Contributor

Thanks for the context!

I will close this issue for now. But please re-open it if you are able to create a reproducible repo that you would like us to look into, or have more information that the bug is on our end!

@bseido
Copy link
Author

bseido commented Apr 5, 2024

Update to give the solution to my problem (in case someone got the same)
The shopify gem automatically use a more recent version of the "graphql-client" gem
This gem wasn't updated since 2022, but since the last update end of january 2024 (0.19 version), the GraphQL does not work

So i had to force in my Gemfile the 0.18 version, and now it is working again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants