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

GraphiQL can't find it's own assets in Rails 6 #2550

Closed
tamouse opened this issue Oct 16, 2019 · 5 comments
Closed

GraphiQL can't find it's own assets in Rails 6 #2550

tamouse opened this issue Oct 16, 2019 · 5 comments

Comments

@tamouse
Copy link

tamouse commented Oct 16, 2019

Steps to recreate

(Rails 6)

rails new my_app --skip-spring --skip-turbolinks --skip-coffee --skip-test --webpack=react --database=postgresql
pushd my_app/
echo >> Gemfile
echo 'gem "graphql"' >> Gemfile
bundle
rails g graphql:install
bundle
rails db:create db:migrate
rails s

Open up http://localhost:3000/graphiql in a browser yields:

Started GET "/graphiql" for ::1 at 2019-10-15 22:25:23 -0500
Processing by GraphiQL::Rails::EditorsController#show as HTML
  Parameters: {"graphql_path"=>"/graphql"}
  Rendering /Users/tamara/.gem/ruby/2.5.1/gems/graphiql-rails-1.7.0/app/views/graphiql/rails/editors/show.html.erb
  Rendered /Users/tamara/.gem/ruby/2.5.1/gems/graphiql-rails-1.7.0/app/views/graphiql/rails/editors/show.html.erb (Duration: 6.3ms | Allocations: 652)
Completed 200 OK in 9ms (Views: 8.3ms | ActiveRecord: 0.0ms | Allocations: 2188)


Started GET "/stylesheets/graphiql/rails/application.css" for ::1 at 2019-10-15 22:25:23 -0500
Started GET "/javascripts/graphiql/rails/application.js" for ::1 at 2019-10-15 22:25:23 -0500
  
ActionController::RoutingError (No route matches [GET] "/stylesheets/graphiql/rails/application.css"): # backtrace elided
ActionController::RoutingError (No route matches [GET] "/javascripts/graphiql/rails/application.js"): # backtrace elided  
@tamouse
Copy link
Author

tamouse commented Oct 16, 2019

Same steps work fine in Rails 5.2.3

@daemonsy
Copy link
Contributor

Hi I believe GraphiQL rails is still using sprockets and probably doesn't work with webpacker.

I've been working on a PR to make it a Rack app on #1051 , but got stuck a little. Will keep this open as motivation!

@sam-enough
Copy link

I was unable to reproduce this problem with the instructions above.

These are the relevant versions I am using:
Rails 6.0.0
Ruby 2.6.3p62
ruby-graphql 1.9.15
graphiql-rails 1.7.0

the body returned by the /graphiql URL contains asset links such as:
/assets/graphiql/rails/application.self-2c9bc09a5afbacf648b10c838cd420bd95f808b6f0f767ab0ed944eb97b5ed5d.css?body=1

@jhirn
Copy link

jhirn commented Dec 17, 2019

This is an issue with rails-graphiql, not this gem. It should be closed here. cc @rmosolgo

I rand into the same problem. I think that gem is not being maintained. There are a couple open issues there about this topic. I switched to graphiql-playground which I'm not a fan of and will soon just mount graphiql directly through package.json which shouldn't be hard to do.

@rmosolgo
Copy link
Owner

Yes, this sounds like a problem with graphiql-rails. Sorry I haven't been able to maintain that so well lately :'(

In the end, I think it needs to be completely redone or replaced, because the latest version of GraphiQL doesn't work with sprockets. How frustrating ... I guess :S

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

5 participants