forest-rails
forest-rails copied to clipboard
Server error in StatsController
Hi team,
We have some 500 http errors on our servers from the StatsController.
Expected behavior
Get 200 or 404 from the server response.
Source: https://github.com/ForestAdmin/forest-rails/blob/a36791da9aa0321a20614a851cbf8c0f676402ba/app/controllers/forest_liana/stats_controller.rb#L30-L34
Actual behavior
Server render 500 in OperatorDateIntervalParser#get_date_filter_for_previous_interval
Failure Logs
NoMethodError:
undefined method `[]' for nil:NilClass
# /usr/local/bundle/gems/forest_liana-5.4.3/app/services/forest_liana/operator_date_interval_parser.rb:138:in `get_date_filter_for_previous_interval'
# /usr/local/bundle/gems/forest_liana-5.4.3/app/services/forest_liana/filters_parser.rb:241:in `parse_previous_interval_condition'
# /usr/local/bundle/gems/forest_liana-5.4.3/app/services/forest_liana/filters_parser.rb:222:in `parse_aggregation_on_previous_interval'
# /usr/local/bundle/gems/forest_liana-5.4.3/app/services/forest_liana/filters_parser.rb:214:in `apply_filters_on_previous_interval'
# /usr/local/bundle/gems/forest_liana-5.4.3/app/services/forest_liana/value_stat_getter.rb:15:in `perform'
# /usr/local/bundle/gems/forest_liana-5.4.3/app/controllers/forest_liana/stats_controller.rb:29:in `get'
Context
Reproduce in test with:
HTTP POST /forest/stats/Api__OrganizationsView
Body:
{
collection: 'CollectionName',
aggregate: 'Count',
type: 'Value',
filters: { field: "field_name", operator: "before_x_hours_ago", value: "240"}.to_json
}
- Package Version:
5.4.3 - Rails Version:
6.0.0 - Database Dialect:
postgres - Database Version:
10