Hello, I currently have an app in rails with graphql that works fine (it only has one view) until I try to access the route for graphiql in production ( since it is in heroku ), every time I try to access the route in question url/graphiql
, although At first it seems to take the route for me, it stays in loading, but when I check the error it shows me on the console, the following appears:
Uncaught Error: Cannot use e "__Schema" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
Looking for the error (it didn't appear much for rails) but they advised me to add a script to package.json resolutions
and put the version for graphql.
My configuration in routes for graph is: (currently I did deploy again removing env)
Rails.application.routes.draw do
#if Rails.env.development?
#mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/graphql"
#end
mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: '/graphql'
post "/graphql", to: "graphql#execute"
mount ActionCable.server, at: '/cable'
root 'static_pages#home'
end
and my gemfile is:
gem 'graphql', '1.9.17'
gem 'graphiql-rails', '1.7.0', group: [:development, :production]
gem 'bcrypt', '~> 3.1.13'
So far I have not been able to find an error similar to mine with heroku in an app with rails and graphql.
That is an open bug even in the latest version. Your options are to downgrade to the version prior to 1.5 where the bug was generated:
or add to your file
config/environment/production.rb
:which from what they say , can greatly increase the final size of your resulting js file in production, so it's not the best option either.
Lastly, just ditch the client and use one of the ones suggested in the comments .