Bug description
We have updated our installation from 4.0.2 to 4.1.2 today. All the Handlebars charts that use formatDate
helper started throwing i is not a function
error.
Steps to reproduce: 1. Create a new dataset with one value.
select '2025-04-01'::timestamp as t
- Create a new Handlebars chart from this dataset.
- Add
t
column to the columns list and hit "Create chart" button. The chart renders normally.
- Modify template as follows:
<ul class="data-list">
{{#each-data}}
<li>{{formatDate 'DD.MM.YYYY' t}}</li>
{{/each}}
</ul>
- Now the chart preview renders the error.
Screenshots/recordings
No response
Superset version
4.1.2
Python version
3.11
Node version
18.20.1
Browser
Chrome
Additional context
There are no related errors present either in the browser console or server logs.
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
The issue you're encountering with the formatDate
helper in Handlebars charts after updating to Superset 4.1.2 might be related to changes in the Handlebars helpers or dependencies. In the 4.1.2 update, new Handlebars helpers for common math operations were added, but there is no specific mention of changes to the formatDate
helper itself [1].
To troubleshoot this issue, consider the following steps:
- Check for Changes in Dependencies: Ensure that the
handlebars
,handlebars-group-by
, andjust-handlebars-helpers
packages are correctly updated to their specified versions in the 4.1.2 update: handlebars
:^4.7.8
handlebars-group-by
:^1.0.1
-
just-handlebars-helpers
:^1.0.19
[2]. -
Review the
formatDate
Implementation: Verify if the implementation of theformatDate
helper function has changed or if there are any known issues with it. The current implementation usesd3.time.format
, which should be checked for compatibility with your data and format string [3]. -
Debug the Error: The error message "i is not a function" suggests that there might be an issue with how the
formatDate
function is being called or with the data being passed to it. Double-check the template syntax and ensure that the data being passed toformatDate
is in the expected format. -
Test with a Simple Template: Try simplifying the template to isolate the issue. For example, test with a static date string to see if the error persists.
If these steps do not resolve the issue, further investigation into the specific changes in the 4.1.2 update or a deeper dive into the just-handlebars-helpers
package might be necessary.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
Comment From: Alex-administrator
@dosu I upgraded the Superset version using the command: pip3 install apache-superset --upgrade When using pip install, the frontend is already pre-built, so I can't inspect the versions of the handlebars, handlebars-group-by, or just-handlebars-helpers packages.
Comment From: rusackas
Sorry, this one has slipped under the radar, and it does appear to be an issue in current master