Error just after installing Forest

  • After going through the ForestAdmin install steps, I see all the collections in Forest but no data.

Expected behavior

  • See the data related to the selected collection

Actual behavior

  • “Cannot reach your data” error message

Failure Logs

Started OPTIONS "/forest/User?fields%5BUser%5D=authentication_token%2Ccreated_at%2Cemail%2Cfirst_name%2Cid%2Cip_address%2Clast_name%2Cpassword_digest%2Csuperuser%2Ctenant%2Cupdated_at%2Cuser_agent&fields%5Btenant%5D=name&page%5Bnumber%5D=1&page%5Bsize%5D=15&searchExtended=0&sort=-id&timezone=Europe%2FBrussels" for ::1 at 2021-02-08 15:23:05 +0100
Started GET "/forest/User?fields%5BUser%5D=authentication_token%2Ccreated_at%2Cemail%2Cfirst_name%2Cid%2Cip_address%2Clast_name%2Cpassword_digest%2Csuperuser%2Ctenant%2Cupdated_at%2Cuser_agent&fields%5Btenant%5D=name&page%5Bnumber%5D=1&page%5Bsize%5D=15&searchExtended=0&sort=-id&timezone=Europe%2FBrussels" for ::1 at 2021-02-08 15:23:05 +0100
Processing by ForestLiana::UserSpace::UserController#index as JSON
  Parameters: {"fields"=>{"User"=>"authentication_token,created_at,email,first_name,id,ip_address,last_name,password_digest,superuser,tenant,updated_at,user_agent", "tenant"=>"name"}, "page"=>{"number"=>"1", "size"=>"15"}, "searchExtended"=>"0", "sort"=>"-id", "timezone"=>"Europe/Brussels", "collection"=>"User"}
No template found for ForestLiana::UserSpace::UserController#index, rendering head :no_content
Completed 204 No Content in 1ms (ActiveRecord: 0.0ms | Allocations: 667)


Started OPTIONS "/forest/User/count?fields%5BUser%5D=authentication_token%2Ccreated_at%2Cemail%2Cfirst_name%2Cid%2Cip_address%2Clast_name%2Cpassword_digest%2Csuperuser%2Ctenant%2Cupdated_at%2Cuser_agent&fields%5Btenant%5D=name&searchExtended=0&timezone=Europe%2FBrussels" for ::1 at 2021-02-08 15:23:05 +0100
Started GET "/forest/User/count?fields%5BUser%5D=authentication_token%2Ccreated_at%2Cemail%2Cfirst_name%2Cid%2Cip_address%2Clast_name%2Cpassword_digest%2Csuperuser%2Ctenant%2Cupdated_at%2Cuser_agent&fields%5Btenant%5D=name&searchExtended=0&timezone=Europe%2FBrussels" for ::1 at 2021-02-08 15:23:05 +0100
Processing by ForestLiana::UserSpace::UserController#count as HTML
  Parameters: {"fields"=>{"User"=>"authentication_token,created_at,email,first_name,id,ip_address,last_name,password_digest,superuser,tenant,updated_at,user_agent", "tenant"=>"name"}, "searchExtended"=>"0", "timezone"=>"Europe/Brussels", "collection"=>"User"}
   (0.2ms)  SELECT COUNT(*) FROM "users"
Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 0.2ms | Allocations: 1275)

Context

Please provide any relevant information about your setup.

  • Rails Version: 6.1.1
  • Database Dialect: Postgres
  • Database Version: 13.1
  • Project Name: Flexio

Hi @jbescoyez !
You have Cannot reach your data displayed ?
The logs you shared are not error logs, do you have any other log ? What about your browser logs ?

Yes, I do have Cannot reach your data displayed.

I think the issue is at this line:

No template found for ForestLiana::UserSpace::UserController#index, rendering head :no_content

How comes the template is not found and therefore no content is sent?

Nothing special in my browser logs (just an error with Drift):

Can you share the UserController class please ?

Not sure to get you. Do you mean the ForestLiana::UserSpace::UserController or my UserController?

If it is mine, I am not sure it will help. I have the same behavior for all collections.

You are right, I won’t see anything there.
Your issue looks a lot like this one.
Are you using fast_jsonapi ?

Yes, I do. Does it mean that Forest is not compatible with the most famous jsonapi lib in Rails?

Actually it should, can you try changing mount ForestLiana::Engine => '/forest' to mount ForestLiana::Engine => '/forest', defaults: { format: 'json' } in your routes.rb ?

Let me know if it works !

Thank you. It solved the problem but another one arose. :confused:

Now, I get the following error:

Records Index error: undefined local variable or method `object' for #<ForestLiana::UserSpace::DocumentSerializer:0x00007ff83db0cfd8>
Did you mean?  object_id
/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/forest_liana-5.4.3/app/serializers/forest_liana/serializer_factory.rb:63:in `type'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/jsonapi-serializers-1.0.1/lib/jsonapi-serializers/serializer.rb:406:in `serialize_primary'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/jsonapi-serializers-1.0.1/lib/jsonapi-serializers/serializer.rb:438:in `block in serialize_primary_multi'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/jsonapi-serializers-1.0.1/lib/jsonapi-serializers/serializer.rb:438:in `map'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/jsonapi-serializers-1.0.1/lib/jsonapi-serializers/serializer.rb:438:in `serialize_primary_multi'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/jsonapi-serializers-1.0.1/lib/jsonapi-serializers/serializer.rb:321:in `serialize'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/forest_liana-5.4.3/app/controllers/forest_liana/application_controller.rb:46:in `serialize_models'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/forest_liana-5.4.3/app/controllers/forest_liana/resources_controller.rb:227:in `render_jsonapi'
	/Users/johndoe/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/forest_liana-5.4.3/app/controllers/forest_liana/resources_controller.rb:36:in `block (2 levels) in index'
...

I’ve dug a bit and realized that you use GitHub - fotinakis/jsonapi-serializers: Pure Ruby readonly serializers for the JSON:API spec. and I use GitHub - jsonapi-serializer/jsonapi-serializer: A fast JSON:API serializer for Ruby (fork of Netflix/fast_jsonapi) (the new name of fast_jsonapi). The two libraries define the following constant JSONAPI::Serializer with a different API.

I do not really know what to do. What do you recommend?

Hey @jbescoyez,

Thanks for taking the time to look into it. I created an issue, you can follow its progress here:

Hey @vince Is it still under your radar? Tnx :slight_smile:

Hi @jbescoyez, sorry we delayed this topic, waiting for a dedicated Rails developer to join the team.
As we didn’t find the right teammate (yet), I think we’ll have to prioritise the investigations about this issue and have a look at it next week.

1 Like