Request had invalid authentication credentials

I’m getting a new error while my app executes workflows following a webhook. The error doesn’t always happen, but when it does, all subsequent actions seem to have the same error. Does anyone have any insight on what might be causing this or how to fix it?

Properties:
{
“AppId”: “eb2ad6d1-36a1-47f2-a5ef-c169b31c7ad6”,
“AppTemplateVersion”: “1.000745”,
“RuleName”: “Webhook”,
“EventType”: “Change”,
“InvokedBy”: “Delete”,
“Server”: “produ99110000QA”,
“IgnoreSecurityFilters”: false,
“TableName”: “Hanford_Status_Helper”,
“RuleTableName”: “Hanford_Status_Helper”,
“OperationUpdateMode”: “UPDATES_ONLY”,
“EventMatch”: “Workflow event successfully matched”,
“Condition”: “=[Run Enum Group]=TRUE”,
“MatchesCondition”: “True”,
“ActionResults”: “Created 1 ActionResults”,
“Action Type”: “TakeAction”,
“Action Name”: “Run bulk data dump”,
“Errors”: “Error: ‘Execute a Sequence of Actions’ Grouped action ‘Enum Group’ child action ‘Enum Item 1’ failed due to error: Error: Unable to add/edit/delete row in table ‘Budget_Quantities’. → Google.Apis.Requests.RequestError\r\nRequest had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. [401]\r\nErrors [\r\n\tMessage[Invalid Credentials] Location[Authorization - header] Reason[authError] Domain[global]\r\n]\r\n:The service sheets has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError\r\nRequest had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. [401]\r\nErrors [\r\n\tMessage[Invalid Credentials] Location[Authorization - header] Reason[authError] Domain[global]\r\n]\r\n\r\n at Google.Apis.Requests.ClientServiceRequest1.<ParseResponse>d__31.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at Google.Apis.Requests.ClientServiceRequest1.Execute()\r\n at Nirvana.Data.GoogleSheetsService.RetryExecute[T](Func2 requestGen) in d:\\a\\1\\s\\V2API\\Providers\\Google\\GoogleSheetsService.cs:line 117\r\n at Nirvana.Data.GoogleTable.GetSpreadSheet(Context context, String spreadsheetId) in d:\\a\\1\\s\\V2API\\Providers\\Google\\GoogleTable.cs:line 440\r\n at Nirvana.Data.GoogleTable..ctor(Context context, Int32 ownerId, String userToken, IObjectInfo fileInfo, String worksheetName, List1 colTypes, List1 keyPositions, Int32[] columnSliceMapping) in d:\\a\\1\\s\\V2API\\Providers\\Google\\GoogleTable.cs:line 65\r\n at Nirvana.Data.GoogleSheetDataV4.AppendRows(Context context, Op op, PhysicalSchema physicalSchema, List1 colTypes, List1 keyPositions, Boolean tryUpsert) in d:\\a\\1\\s\\V2API\\Providers\\Google\\GoogleSheetDataV4.cs:line 109\r\n at Nirvana.Data.GDriveStorageProvider.AppendTableRows(Context context, Op op, String name, Int32 ownerId, String userToken, PhysicalSchema physicalSchema, DataFormat fileFormat, List1 colTypes, List1 keyPositions) in d:\\a\\1\\s\\V2API\\Providers\\Google\\GDriveStorageProvider\\GDriveTableOperations.cs:line 32\r\n at Nirvana.Data.DataLayer.AppendTableRows(Context context, Op op, Int32 ownerId, AppTable appTable, List1 colTypes, List`1 keyPositions) in d:\a\1\s\V2API\DataLayer\DataAccess.cs:line 316\r\n at Nirvana.Internal.InternalAPI.AddTableRowInternal(Context context, Op op, Int32 userId, Int32 executeAs, ChangeEventWorkflowRuleEvaluator changeEventWorkflowRuleEvaluator) in d:\a\1\s\V2API\InternalAPI\AddDeleteUpdate.cs:line 323\r\n at Nirvana.Internal.InternalAPI.PerformOperation(Context context, Op op, Int32 userId, String appTemplateVersion, Boolean& success, String& errorMessage, Exception& errorException, UpdateModeEnum requiredUpdateMode, RowOperation rowOperation) in d:\a\1\s\V2API\InternalAPI\AddDeleteUpdate.cs:line 221”,
“AppTemplateName”: “HanfordStatus-1049060”,
“Operation”: “Workflow action”,
“Result”: “Failure”
}

Hi Conor,

It looks like you are trying to do too much work in a single REST API call.
I am looking at the REST API 'Edit" request that appears in Audit History at 11/25/2019 4:31:13 PM.
That REST API ‘Edit’ request contains 223 data records.
Each of the edit requests invokes a webhook called “Webhook” that is invoking an action named “Run bulk data dump” that is invoking the action “Enum Group”.
Action “Enum Group” is a composite actions that is performing 12 child actions.
Eleven of those actions are adding new rows to a table. The final action is doing a delete.
Each call to “Webhook” is taking between 10 and 30 seconds.
The entire REST API call took over 40 minutes before it terminated.
This is too much work to perform in a single REST API call.
​You might including fewer data records in the initial REST API request.