ForestAdmin / forest-rails

💎 Ruby on Rails agent for Forest Admin to integrate directly to your existing Ruby on Rails backend application.
https://www.forestadmin.com
GNU General Public License v3.0
374 stars 77 forks source link

resources_controller#index doesn't correctly detect the "Accept" header and thus sends empty responses #369

Closed le-martre closed 1 year ago

le-martre commented 4 years ago

Expected behavior

I expect to be able to fetch lists of items successfuly.

Actual behavior

Rails responds with no content : "No template found for ForestLiana::UserSpace::UserController#index, rendering head :no_content" Despite the Accept header being == 'application/json' (checked with a log in the forest-rails code).

This only happens on the Index endpoint (only one using respond_to it looks like)

Changing mount ForestLiana::Engine => '/forest' to mount ForestLiana::Engine => '/forest', defaults: { format: 'json' } in my routes.rb file fixed the problem. I was thinking of making a PR to add it to the installer but that's probably a bad idea since there has to be a root cause for this behaviour?

Failure Logs

See : https://community.forestadmin.com/t/resolved-will-send-a-pr-rails-gem-forest-liana-cannot-find-a-template-to-respond-with-cannot-reach-your-data/684

Context

Gemfile :

GIT remote: https://github.com/fast-jsonapi/fast_jsonapi revision: 18196294081e34cc065b67013a64dd524ff2c310 specs: fast_jsonapi (1.7.2) activesupport (>= 4.2)

GEM remote: https://rubygems.org/ specs: actioncable (6.0.3.1) actionpack (= 6.0.3.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailbox (6.0.3.1) actionpack (= 6.0.3.1) activejob (= 6.0.3.1) activerecord (= 6.0.3.1) activestorage (= 6.0.3.1) activesupport (= 6.0.3.1) mail (>= 2.7.1) actionmailer (6.0.3.1) actionpack (= 6.0.3.1) actionview (= 6.0.3.1) activejob (= 6.0.3.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (6.0.3.1) actionview (= 6.0.3.1) activesupport (= 6.0.3.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actiontext (6.0.3.1) actionpack (= 6.0.3.1) activerecord (= 6.0.3.1) activestorage (= 6.0.3.1) activesupport (= 6.0.3.1) nokogiri (>= 1.8.5) actionview (6.0.3.1) activesupport (= 6.0.3.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) active_model_serializers (0.10.10) actionpack (>= 4.1, < 6.1) activemodel (>= 4.1, < 6.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) activejob (6.0.3.1) activesupport (= 6.0.3.1) globalid (>= 0.3.6) activemodel (6.0.3.1) activesupport (= 6.0.3.1) activerecord (6.0.3.1) activemodel (= 6.0.3.1) activesupport (= 6.0.3.1) activestorage (6.0.3.1) actionpack (= 6.0.3.1) activejob (= 6.0.3.1) activerecord (= 6.0.3.1) marcel (~> 0.3.1) activesupport (6.0.3.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) akami (1.3.1) gyoku (>= 0.4.0) nokogiri arel-helpers (2.11.0) activerecord (>= 3.1.0, < 7) base32 (0.3.2) bcrypt (3.1.13) bootsnap (1.4.6) msgpack (~> 1.0) bugsnag (6.13.1) concurrent-ruby (~> 1.0) builder (3.2.4) byebug (11.1.3) case_transform (0.2) activesupport cloudflare-rails (0.6.0) httparty rails (>= 5.0, < 6.1.0) coderay (1.1.3) concurrent-ruby (1.1.6) connection_pool (2.2.2) crass (1.0.6) dotenv (2.7.5) dotenv-rails (2.7.5) dotenv (= 2.7.5) railties (>= 3.2, < 6.1) erubi (1.9.0) faker (2.12.0) i18n (>= 1.6, < 2) faraday (1.0.1) multipart-post (>= 1.2, < 3) forest_liana (5.2.1) arel-helpers base32 bcrypt groupdate (= 2.5.2) httparty ipaddress jsonapi-serializers (>= 0.14.0) jwt rack-cors rails (>= 4.0) rotp useragent globalid (0.4.2) activesupport (>= 4.2.0) groupdate (2.5.2) activesupport (>= 3) gyoku (1.3.1) builder (>= 2.1.2) httparty (0.18.1) mime-types (~> 3.0) multi_xml (>= 0.5.2) httpi (2.4.4) rack socksify i18n (1.8.2) concurrent-ruby (~> 1.0) ipaddress (0.8.3) json (2.3.0) jsonapi-deserializable (0.2.0) jsonapi-renderer (0.2.2) jsonapi-serializers (1.0.1) activesupport jwt (2.2.1) launchy (2.5.0) addressable (~> 2.7) letter_opener (1.7.0) launchy (~> 2.2) loofah (2.5.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2020.0512) mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.1) msgpack (1.3.3) multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) nori (2.6.0) oj (3.10.6) pg (1.2.3) postmark (1.21.1) json postmark-rails (0.20.0) actionmailer (>= 3.0.0) postmark (~> 1.15) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) pry-rails (0.3.9) pry (>= 0.10.4) public_suffix (4.0.5) puma (4.3.5) nio4r (~> 2.0) rack (2.2.2) rack-attack (6.3.1) rack (>= 1.0, < 3) rack-cors (1.1.1) rack (>= 2.0.0) rack-protection (2.0.8.1) rack rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.0.3.1) actioncable (= 6.0.3.1) actionmailbox (= 6.0.3.1) actionmailer (= 6.0.3.1) actionpack (= 6.0.3.1) actiontext (= 6.0.3.1) actionview (= 6.0.3.1) activejob (= 6.0.3.1) activemodel (= 6.0.3.1) activerecord (= 6.0.3.1) activestorage (= 6.0.3.1) activesupport (= 6.0.3.1) bundler (>= 1.3.0) railties (= 6.0.3.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (6.0.3.1) actionpack (= 6.0.3.1) activesupport (= 6.0.3.1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rake (13.0.1) redis (4.1.4) redis-prescription (1.0.0) rotp (6.0.0) addressable (~> 2.7) savon (2.12.0) akami (~> 1.2) builder (>= 2.1.2) gyoku (~> 1.2) httpi (~> 2.3) nokogiri (>= 1.8.1) nori (~> 2.4) wasabi (~> 3.4) secure_headers (6.3.0) sidekiq (5.1.3) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) redis (>= 3.3.5, < 5) sidekiq-throttled (0.11.0) concurrent-ruby redis-prescription sidekiq socksify (1.7.1) sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) stripe (5.22.0) thor (1.0.1) thread_safe (0.3.6) tzinfo (1.2.7) thread_safe (~> 0.1) useragent (0.16.10) valvat (0.9.1) savon (>= 2.3.0) wasabi (3.5.0) httpi (~> 2.0) nokogiri (>= 1.4.2) websocket-driver (0.7.2) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zeitwerk (2.3.0)

PLATFORMS ruby

DEPENDENCIES active_model_serializers addressable bcrypt (~> 3.1.7) bootsnap (>= 1.4.2) bugsnag (~> 6.13) byebug cloudflare-rails dotenv-rails faker faraday fast_jsonapi (~> 1.7.2)! forest_liana (~> 5.2.1) jsonapi-deserializable (~> 0.2.0) letter_opener oj (~> 3.10.6) pg (>= 0.18, < 2.0) postmark-rails pry-rails puma (~> 4.1) rack-attack (~> 6.3.1) rack-cors (~> 1.1) rails (~> 6.0.3) redis (~> 4.0) secure_headers (~> 6.3) sidekiq (~> 5.1.3) sidekiq-throttled stripe valvat

RUBY VERSION ruby 2.7.0p0

BUNDLED WITH 2.1.2

matthv commented 1 year ago

More information about this issue here : https://community.forestadmin.com/t/resolved-issue-369-on-github-rails-gem-forest-liana-cannot-find-a-template-to-respond-with-cannot-reach-your-data/684/6

I’m closing this inactive issue. Don’t hesitate to open a new one if you encounter a bug.