NoMethodError: undefined method `to_h' for #<Salesforce::ParamStructs::CategorizedData
Problem
When enable FF param_structs_categorized_data, Salesforce::CreateOpportunityWorker
will throw error NoMethodError: undefined method
to_h' for #<Salesforce::ParamStructs::CategorizedData`.
This error is from this code
if Unleash.enabled?(:param_structs_categorized_data)
Salesforce::ParamStructs::CategorizedData.new(data: JSON.parse(salesforce_data))
else
JSON.parse(salesforce_data, object_class: Salesforce::ParamStructs::Data)
end
This is because the class Salesforce::ParamStructs::CategorizedData
does not have to_h
method.
This error happens both on production server and staging server.
- error logs from production server: https://console.cloud.google.com/logs/query;query=%22Salesforce::ParamStructs::CategorizedData%22;cursorTimestamp=2024-05-07T13:08:18.624Z?project=gitlab-subscriptions-prod
- error logs from staging server: https://console.cloud.google.com/logs/query;query=%22Salesforce::ParamStructs::CategorizedData%22;cursorTimestamp=2024-05-09T08:22:03.133Z;duration=P10D?project=gitlab-subscriptions-staging
NOTE: the last production error happened on 2024-05-07, I guess it is due to the feature flag was disabled on production after 2024-05-07
Proposal
Disable the FF on all environment temporarily, fix the bug and re-enable the FF.
Result
Next steps (if any)
How will we measure success?
Edited by Qingyu Zhao