Skip to content

Server error in StatsController #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
maxime-d opened this issue Feb 22, 2021 · 0 comments
Open

Server error in StatsController #430

maxime-d opened this issue Feb 22, 2021 · 0 comments

Comments

@maxime-d
Copy link

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:

if stat.record
render json: serialize_model(stat.record), serializer: nil
else
render json: {status: 404}, status: :not_found, serializer: nil
end

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant