Can't render chart issue with forest_liana 7.7.1

Feature(s) impacted

Charts in Forest dashboard

Observed behavior

Time-based chart doesn’t render in production (it does in Development environment). It returns a 404 error.

Expected behavior

Chart should render without error.

Failure Logs

2022-11-15T07:47:28.865025+00:00 heroku[router]: at=info method=POST path=“/forest/stats/PromptScore?timezone=Europe%2FParis” host=findtheprompt.com request_id=f8ec25f1-48b4-4af4-b1e4-756ff68808b5 fwd=“78.174.180.145,162.158.251.105” dyno=web.1 connect=0ms service=5ms status=404 bytes=704 protocol=https
2022-11-15T07:47:28.861896+00:00 app[web.1]: I, [2022-11-15T07:47:28.861812 #4] INFO – : [f8ec25f1-48b4-4af4-b1e4-756ff68808b5] Started POST “/forest/stats/PromptScore?timezone=Europe%2FParis” for 162.158.251.105 at 2022-11-15 07:47:28 +0000
2022-11-15T07:47:28.863297+00:00 app[web.1]: I, [2022-11-15T07:47:28.863239 #4] INFO – : [f8ec25f1-48b4-4af4-b1e4-756ff68808b5] Processing by ForestLiana::StatsController#get as JSON
2022-11-15T07:47:28.863348+00:00 app[web.1]: I, [2022-11-15T07:47:28.863314 #4] INFO – : [f8ec25f1-48b4-4af4-b1e4-756ff68808b5] Parameters: {“type”=>“Line”, “collection”=>“PromptScore”, “group_by_date_field”=>“created_at”, “aggregate”=>“Count”, “time_range”=>“Day”, “timezone”=>“Europe/Paris”}
2022-11-15T07:47:28.864434+00:00 app[web.1]: I, [2022-11-15T07:47:28.864385 #4] INFO – : [f8ec25f1-48b4-4af4-b1e4-756ff68808b5] Filter chain halted as #<Proc:0x00007f6097dd3d90 /app/vendor/bundle/ruby/3.1.0/gems/forest_liana-7.7.1/app/controllers/forest_liana/stats_controller.rb:12> rendered or redirected
2022-11-15T07:47:28.864557+00:00 app[web.1]: I, [2022-11-15T07:47:28.864517 #4] INFO – : [f8ec25f1-48b4-4af4-b1e4-756ff68808b5] Completed 404 Not Found in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 358)
2022-11-15T07:47:28.508441+00:00 app[web.1]: I, [2022-11-15T07:47:28.508354 #4] INFO – : [eda27d42-abf6-47d3-9811-cb797af759f7] Started OPTIONS “/forest/authentication/callback?code=4jr0KfW_LpWQiBkwC-oyXgpUMYRtqiQUWtWFktZHohDGklBhs2tyopWvd6jqk3Ts&state=%7B%22renderingId%22%3D%3E163199%7D” for 162.158.251.86 at 2022-11-15 07:47:28 +0000
2022-11-15T07:47:28.603507+00:00 app[web.1]: I, [2022-11-15T07:47:28.603407 #4] INFO – : [f356d087-d08a-42cc-86d2-3c13a46d8411] Started GET “/forest/authentication/callback?code=4jr0KfW_LpWQiBkwC-oyXgpUMYRtqiQUWtWFktZHohDGklBhs2tyopWvd6jqk3Ts&state=%7B%22renderingId%22%3D%3E163199%7D” for 162.158.251.105 at 2022-11-15 07:47:28 +0000
2022-11-15T07:47:28.604321+00:00 app[web.1]: I, [2022-11-15T07:47:28.604281 #4] INFO – : [f356d087-d08a-42cc-86d2-3c13a46d8411] Processing by ForestLiana::AuthenticationController#authentication_callback as /
2022-11-15T07:47:28.604355+00:00 app[web.1]: I, [2022-11-15T07:47:28.604332 #4] INFO – : [f356d087-d08a-42cc-86d2-3c13a46d8411] Parameters: {“code”=>“4jr0KfW_LpWQiBkwC-oyXgpUMYRtqiQUWtWFktZHohDGklBhs2tyopWvd6jqk3Ts”, “state”=>“{"renderingId"=>163199}”}
2022-11-15T07:47:28.753236+00:00 app[web.1]: I, [2022-11-15T07:47:28.753148 #4] INFO – : [f356d087-d08a-42cc-86d2-3c13a46d8411] Completed 200 OK in 149ms (Views: 0.3ms | ActiveRecord: 0.0ms | Allocations: 4302)

In console:

No error in network tab.

Context

  • Project name: Find The Prompt
  • Team name: Operations
  • Environment name: Production
  • Agent type & version: forest_liana 7.7.1
  • Rails: rails 7.0.4
  • Ruby: ruby 3.1.2
  • Browser used: Chrome Version 107.0.5304.110 (Build officiel) (arm64)

Chart config:

Thanks for your help! (also have this issue with other apps, I can’t upgrade to Forest > 7)

Hi @nico_lrx,

Did the problem appeared recently ?

Kind regards,

Shohan

Hello @shohanr, it’s a new project, I just launched the app in production yesterday.

For the explanation, in production, the agent can not find the model PromptScore.
It seems that you do not have the definition of the model in prod and this creates the problem.
To solve the issue, you need to add and push to prod your .forestadmin-schema.json.

Keep me updated if it suits your case.

Best regards,

Shohan

I already pushed .forestadmin-schema.json in production. Also, the model PromptScore is there:

Ok, thank you for the screenshot.
We are looking into it.
We will keep you updated in the shortest delays.

Best,

Shohan

1 Like

Hi @nico_lrx,

Could you check that the route /forest/stats/:collection exists in production.

You can check with the rails:routes command.

Hello @nicolasa, it seems like so:

Does the problem on the Time based chart also appear with other collections ?

I can’t really try unfortunately as I only have two other tables without timestamps.

Could you try with another type of chart ?

I just tried a distribution chart and it works.

Can you share your PromptScore model and did you use the PromptScore collection for the distribution graph?
If not, can you test another graph on this collection?

If I do another graph on the PromptScore collection, then it doesn’t work.

Here is prompt_score.rb model:

Here is prompt.rb model:

Thanks!

Could you please check the configuration for any differences between development and production ?

Can you also check in production that the prompt_score.rb file has no typo on the file name and/or on the PromptScore class name

Finally, did you touch the autoloader configuration ? more details here : Autoloading and Reloading Constants — Ruby on Rails Guides