Graphql-ruby: Uninitialized constant GraphQL::Types::JSON

Created on 27 Jun 2019  路  2Comments  路  Source: rmosolgo/graphql-ruby

I tried to add it to one of my fields like so

field :line_items, GraphQL::Types::JSON, null: false

And it breaks as Types::JSON does not seem to be defined. However your documentation says it's a built-in scalar so I don't really understand.

https://github.com/rmosolgo/graphql-ruby/blob/master/guides/type_definitions/scalars.md

Trace

{
  "error": {
    "message": "uninitialized constant GraphQL::Types::JSON",
    "backtrace": [
      "/Users/loschcode/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant'",
      "/Users/loschcode/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'",
      "/Users/loschcode/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'",
      "/Users/loschcode/Desktop/work/projects/askalfred/askalfred-app/api/app/graphql/types/event_payment_authorization.rb:6:in `<class:EventPaymentAuthorization>'",
      "/Users/loschcode/Desktop/work/projects/askalfred/askalfred-app/api/app/graphql/types/event_payment_authorization.rb:2:in `<module:Types>'",
      "/Users/loschcode/Desktop/work/projects/askalfred/askalfred-app/api/app/graphql/types/event_payment_authorization.rb:1:in `<main>'",
      "/Users/loschcode/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'",
      "/Users/loschcode/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'",
      "/Users/loschcode/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.2.1/lib/active_support/dependencies/interlock.rb:14:in `block in loading'",

Most helpful comment

@Loschcode, it's a new[er] addition. Probably you're on an old version of graphql-ruby and just need to update.

All 2 comments

@Loschcode, it's a new[er] addition. Probably you're on an old version of graphql-ruby and just need to update.

It was added in 1.9.5: https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md#195-22-may-2019

Please check your version and update if necessary. If you're still having trouble, please reopen and share the output of bundle info graphql!

Was this page helpful?
0 / 5 - 0 ratings