Hello,
I’m fairly new to Forest
I am trying to render a leaderbord Chart on my forest admin Dashboard showing the Number of tasks created per User…
Expected behavior
Render a Leaderboard chart
Actual behavior
Forest Admin cannot render this chart, syntax error at or near “.” The other charts on the page render correctly and I am able to render LeaderBoards on other tables. (this seems to be due to an unauthorised access to the users table)
Failure Logs
When I look at the Chrome console, I get a 401 on this request “forest/stats/users” with the following error message "detail: “Forest cannot authenticate the user for this request.”
POST /forest/stats/users 500 103 - 786.491 ms [forest] 🌳🌳🌳 Unexpected error: syntax error at or near "." SequelizeDatabaseError: syntax error at or near "."
I am not sure where I can find for the raw sequel query.
SELECT COUNT("tasks"."id") as "value", user.lastname as "key"
FROM "tasks"
INNER JOIN "users" AS "user"
ON "user"."id" = "tasks"."user_id"
GROUP BY user.lastname
ORDER BY "value" DESC
LIMIT 20
Same problem here, it seems that there was a problem with the auto-generated SQL query from leaderboard chart:
SELECT COUNT("tasks"."id") as "value", user.email as "key"
FROM "tasks"
INNER JOIN "users" AS "user"
ON "user"."id" = "tasks"."user_id"
GROUP BY user.email
ORDER BY "value" DESC
LIMIT 10
Fixed by adding the missing quotes around user.email and by manually filling in the “QUERY” field.
SELECT COUNT("tasks"."id") as "value", "user"."email" as "key"
FROM "tasks"
INNER JOIN "users" AS "user"
ON "user"."id" = "tasks"."user_id"
GROUP BY "user"."email"
ORDER BY "value" DESC
LIMIT 10
Hi @bqst welcome to our community.
Hi @Christopher_Bagard I reproduced your issue, the problems here is user is a reserved word on some DBMS. To access your database we must use quotes.
So I will open a bug report on our side to fix this issue.
I’m happy to see you found a workaround
I will keep you update when the fix was implemented.
Hi guys (@bqst, @Christopher_Bagard) a fix has been released, make sure you installed the forest-express-sequelize >= 6.5.1.
Let me know if the issue persist.