Upgrade to forest_liana gem 7.0 issue

Observed behavior

I try to upgrade to forest_liana v7.0 for my rails app. When I open the Forest dashboard, charts are not showing up anymore:

I followed the upgrading instructions.

Expected behavior

The chart should display the data properly.

Failure Logs

  • See console errors on the previous picture
  • Rails logs look good:

Context

  • Project name: La langue française
  • Environment name: Development / Production
  • Ruby version: 3.1.2
  • Rails version: 6.1.6
  • Forest liana version: ‘~> 7.0’, ‘< 7.1.0’

Thanks.

Hey @nico_lrx :wave:

I will look into it :man_detective:.
In the meantime, do you mind sharing the configuration of your chart? You can share the data with me in a private message if the data is sensitive.

Hey @Romain_Coudour,
Here is the chart configuration:

@nico_lrx Thanks!

I’ll keep you posted :hourglass_flowing_sand::gear: :hammer:

1 Like

Hi @nico_lrx,
Could your please share the response payload of /forest/stats/User ?

Hello @vince,
Here is all I have (development environment):

Oh sorry I was not explicit enough :sweat_smile:. I meant in your browser, can you look at the network tabs and click on this call and send the response payload please :pray:

Here it is:

Maybe there is an error with the timezone “Europe/Istanbul”? :thinking:

This is actually the request payload, I need the Preview or Response tab :smile:

Hello @vince, here is the payload:

{“data”:{“type”:“stats”,“id”:“cdf3a718-e1a4-4cf6-921f-277b11b4859f”,“attributes”:{“value”:{“countCurrent”:27001,“countPrevious”:null}}}}

Okey what is weird is the response is actually the response for a Value chart :thinking:. Could you please try to do all type of charts and let me know if it’s only Line/Time chart that doesn’t work ?

@vince, sorry, indeed this wasn’t the good response…

Here it is:

{“data”:{“type”:“stats”,“id”:“490819d9-6a87-41f5-9e2f-0401064eaf89”,“attributes”:{“value”:}}}

Things have evolved a bit since my last attempt to upgrade last September, so here is a recap:

Issue #1

Right now, the # Users / day chart works, but not the one using a monthly interval:

The first line chart response (# User / day) has data in it. The other one has no data:

{“data”:{“type”:“stats”,“id”:“490819d9-6a87-41f5-9e2f-0401064eaf89”,“attributes”:{“value”:}}}

I don’t have the “Cannot convert undefined or null to object” error in console anymore.

Issue #2

There is a 500 error for my # New comments / day line chart. In console:

In logs:

ActiveRecord::StatementInvalid : PG::GroupingError: ERROR: column “comments.created_at” must appear in the GROUP BY clause or be used in an aggregate function LINE 1: …tz AT TIME ZONE ‘Europe/Istanbul’)::date ORDER BY “comments”… ^

  • Project name: La langue française
  • Environment name: Development / Production
  • Ruby version: 3.1.2
  • Rails version: 6.1.7
  • Forest liana version: 7.1.0

Thanks!

Could you please share the full SQL query ?

Here it is:

Maybe a PostgreSQL version issue?

Hmm yeah it might be :thinking:. Which version are you using ?

For now I use pg gem 1.4.4 and postgres (PostgreSQL) 14.2

Not linked to your version of Postgres at least but the generated query is badly formatted, the ORDER BY should be date_trunc_day_comments_created_at_timestamptz_at_time_zone_eur. Let me check if that could be linked to the pg driver :eyes:

I think it’s a issue on our side. I will create a bug ticket. You will be able to follow its status just below :wink:

Did you add a order by somewhere in your code ? Because we don’t have any order by when doing a time chart :thinking:

Would you be using paranoid models with a default_scope that ORDER BY createdAt ?

1 Like

Indeed, I have this in my Comment model:

default_scope { order(created_at: :desc) }

Is it an issue? I use it to display in the right order the comments.