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

undefined method `definition_default_resolve' after 1.11.5 upgrade #3181

Closed
ajkerr opened this issue Oct 5, 2020 · 1 comment · Fixed by #3182
Closed

undefined method `definition_default_resolve' after 1.11.5 upgrade #3181

ajkerr opened this issue Oct 5, 2020 · 1 comment · Fixed by #3182

Comments

@ajkerr
Copy link
Contributor

ajkerr commented Oct 5, 2020

Describe the bug

After attempting to upgrade to version 1.11.5, we are getting the following error raised when trying to access a scalar on one of our queries. This did not occur in version 1.11.4.

Versions

graphql version: 1.11.5
rails (or other framework): 6.0.3.3
graphql-batch: 0.4.3
graphql-client: 0.16.0

GraphQL schema

The problem seems to be related to accessing the originalSrc scalar on this GraphQL type:

https://shopify.dev/docs/admin-api/graphql/reference/object/image

GraphQL query

Example GraphQL query and response (if query execution is involved)

query ProductVariants($first: Int!, $query: String!, $after: String) {
  productVariants(first: $first, after: $after, query: $query) {
    pageInfo {
      hasNextPage
    }
    edges {
      cursor
      node {
        id
        sku
        image {
          originalSrc
        }
        product {
          id
          title
          hasOnlyDefaultVariant
          tags
          images(first: 1) {
            edges {
              node {
                originalSrc
              }
            }
          }
        }
      }
    }
  }
}

Steps to reproduce

Run the query and attempt to access image.original_src on one of the nodes.

Expected behavior

The query should work.

Actual behavior

What specifically went wrong?

Place full backtrace here (if a Ruby exception is involved):

Click to view exception backtrace
          NoMethodError:
            undefined method `definition_default_resolve' for #<GraphQL::Schema ...>
            Did you mean?  define_singleton_method
          # /Users/ajkerr/.gem/ruby/2.7.1/gems/graphql-1.11.5/lib/graphql/schema/build_from_definition.rb:207:in `coerce_input'
          # /Users/ajkerr/.gem/ruby/2.7.1/gems/graphql-1.11.5/lib/graphql/schema/member/validates_input.rb:24:in `coerce_isolated_input'
          # /Users/ajkerr/.gem/ruby/2.7.1/gems/graphql-client-0.16.0/lib/graphql/client/schema/scalar_type.rb:38:in `cast'
          # /Users/ajkerr/.gem/ruby/2.7.1/gems/graphql-client-0.16.0/lib/graphql/client/schema/non_null_type.rb:39:in `cast'
          # /Users/ajkerr/.gem/ruby/2.7.1/gems/graphql-client-0.16.0/lib/graphql/client/schema/object_type.rb:71:in `block (3 levels) in <module:ObjectType>'
          # /Users/ajkerr/.gem/ruby/2.7.1/gems/graphql-client-0.16.0/lib/graphql/client/schema/object_type.rb:70:in `fetch'
          # /Users/ajkerr/.gem/ruby/2.7.1/gems/graphql-client-0.16.0/lib/graphql/client/schema/object_type.rb:70:in `block (2 levels) in <module:ObjectType>'
@rmosolgo
Copy link
Owner

rmosolgo commented Oct 6, 2020

Thanks for the detailed bug report! I did a refactor of Schema.from_definition but evidently, I missed a spot 🙈 . I'll take a look and follow up here.

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