Happy Business Starts Here

Handle Nightly Permissions Refresh Errors More Gracefully

Every night there is a scheduled process that runs to sync the status of the Entitlements and Hosted Payment Method Pages into salesforce. These tend to error a lot (about 25% of the time) which generates an unhandled exception email to our admin monitoring.

 

Since this error is not terribly impactful (waiting 36 hrs instead of 12 hrs for a new feature to show up), it would be helpful if these errors were handled more gracefully. We monitor the unhandled exceptions and generate support cases whenever we get one and it's we're constantly getting asked whether this is something that's broken.

 

It appears that the error is because a callout to Zuora is returning HTML instead of JSON. So things could potentially be fixed by ensuring the API returns JSON in error cases instead of html

 

== zqu.RefreshCustomSettingSchedulable.refreshEntitlementPermission() ==

 

Failed to invoke future method 'global static void refreshEntitlementPermission()' on class 'zqu.RefreshCustomSettingSchedulable' for job id '7071300002M2Qhs'

caused by: System.JSONException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]

Class.System.JSON.deserializeUntyped: line 11, column 1
Class.zqu.RefreshCustomSettingSchedulable.refreshEntitlementPermission: line 67, column 1

 

== zqu.RefreshCustomSettingSchedulable.refreshHpmPermissions() ==

Failed to invoke future method 'global static void refreshHpmPermissions()' on class 'zqu.RefreshCustomSettingSchedulable' for job id '7071300002M2Qht'

caused by: System.JSONException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]

Class.System.JSON.deserialize: line 15, column 1
Class.zqu.PermissionCheckService.checkPermission: line 26, column 1
Class.zqu.RefreshCustomSettingSchedulable.refreshHpmPermissions: line 29, column 1

1 Comment
Guru

I belive this is a bug that should be fixed. We receive these errors from several sandboxes for several different permissions every day.