mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ResponseOps] Set action type thrown errors as Framework errors (#179700)
Related to https://github.com/elastic/kibana/issues/174035 ## Summary This PR changes errors reported from the action type executors from USER to FRAMEWORK. ### To verify - Throw an error in any an action executor - Expect to see framework error metrics in : `/api/task_manager/metrics?reset=false`
This commit is contained in:
parent
5469e88705
commit
ad99ea8d3d
10 changed files with 43 additions and 40 deletions
|
@ -1182,11 +1182,14 @@ describe('Action Executor', () => {
|
|||
);
|
||||
connectorTypeRegistry.get.mockReturnValueOnce(connectorType);
|
||||
|
||||
let executorResult;
|
||||
if (executeUnsecure) {
|
||||
await actionExecutor.executeUnsecured(executeUnsecuredParams);
|
||||
executorResult = await actionExecutor.executeUnsecured(executeUnsecuredParams);
|
||||
} else {
|
||||
await actionExecutor.execute(executeParams);
|
||||
executorResult = await actionExecutor.execute(executeParams);
|
||||
}
|
||||
|
||||
expect(executorResult?.errorSource).toBe(TaskErrorSource.FRAMEWORK);
|
||||
expect(loggerMock.warn).toBeCalledWith(
|
||||
'action execution failure: test:1: 1: an error occurred while running the action: this action execution is intended to fail; retry: true'
|
||||
);
|
||||
|
|
|
@ -516,7 +516,7 @@ export class ActionExecutor {
|
|||
serviceMessage: err.message,
|
||||
error: err,
|
||||
retry: true,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,7 +291,7 @@ export default function bedrockTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Sub action "invalidAction" is not registered. Connector id: ${bedrockActionId}. Connector name: Amazon Bedrock. Connector type: .bedrock`,
|
||||
});
|
||||
});
|
||||
|
@ -637,7 +637,7 @@ export default function bedrockTest({ getService }: FtrProviderContext) {
|
|||
connector_id: bedrockActionId,
|
||||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Status code: 422. Message: API Error: Unprocessable Entity - Malformed input request: extraneous key [ooooo] is not permitted, please reformat your input and try again.',
|
||||
});
|
||||
|
|
|
@ -471,7 +471,7 @@ export default function casesWebhookTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'[Action][Webhook - Case Management]: Unable to create case. Error: JSON Error: Create case JSON body must be valid JSON. ',
|
||||
});
|
||||
|
@ -502,7 +502,7 @@ export default function casesWebhookTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'[Action][Webhook - Case Management]: Unable to update case with id 12345. Error: JSON Error: Update case JSON body must be valid JSON. ',
|
||||
});
|
||||
|
@ -570,7 +570,7 @@ export default function casesWebhookTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'[Action][Webhook - Case Management]: Unable to create comment at case with id 123. Error: JSON Error: Create comment JSON body must be valid JSON. ',
|
||||
});
|
||||
|
@ -638,7 +638,7 @@ export default function casesWebhookTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'[Action][Webhook - Case Management]: Unable to create case. Error: Invalid Create case URL: Error: Invalid protocol. ',
|
||||
});
|
||||
|
@ -669,7 +669,7 @@ export default function casesWebhookTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'[Action][Webhook - Case Management]: Unable to update case with id 12345. Error: Invalid Update case URL: Error: Invalid URL. ',
|
||||
});
|
||||
|
@ -737,7 +737,7 @@ export default function casesWebhookTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'[Action][Webhook - Case Management]: Unable to create comment at case with id 123. Error: Invalid Create comment URL: Error: Invalid URL. ',
|
||||
});
|
||||
|
|
|
@ -198,7 +198,7 @@ export default function d3SecurityTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Sub action "invalidAction" is not registered. Connector id: ${d3SecurityActionId}. Connector name: D3 Security. Connector type: .d3security`,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -267,7 +267,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Sub action "invalidAction" is not registered. Connector id: ${genAiActionId}. Connector name: OpenAI. Connector type: .gen-ai`,
|
||||
});
|
||||
});
|
||||
|
@ -487,7 +487,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
|
|||
connector_id: genAiActionId,
|
||||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Status code: 422. Message: API Error: Unprocessable Entity - The model `bad model` does not exist',
|
||||
});
|
||||
|
|
|
@ -191,7 +191,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Sub action "invalidAction" is not registered. Connector id: ${opsgenieActionId}. Connector name: Opsgenie. Connector type: .opsgenie`,
|
||||
});
|
||||
});
|
||||
|
@ -210,7 +210,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [message]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -230,7 +230,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [alias]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -263,7 +263,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [responders.0]: types that failed validation:\n- [responders.0.0.type]: types that failed validation:\n - [responders.0.type.0]: expected value to equal [team]\n - [responders.0.type.1]: expected value to equal [user]\n - [responders.0.type.2]: expected value to equal [escalation]\n - [responders.0.type.3]: expected value to equal [schedule]\n- [responders.0.1.id]: expected value of type [string] but got [undefined]\n- [responders.0.2.username]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -293,7 +293,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [responders.0]: types that failed validation:\n- [responders.0.0.name]: expected value of type [string] but got [undefined]\n- [responders.0.1.id]: expected value of type [string] but got [undefined]\n- [responders.0.2.username]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -396,7 +396,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [visibleTo.0]: types that failed validation:\n- [visibleTo.0.0.type]: expected value to equal [team]\n- [visibleTo.0.1.id]: expected value of type [string] but got [undefined]\n- [visibleTo.0.2.id]: expected value of type [string] but got [undefined]\n- [visibleTo.0.3.username]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -461,7 +461,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [details.bananas]: expected value of type [string] but got [number])',
|
||||
});
|
||||
|
@ -697,7 +697,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: opsgenieActionId,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Status code: 422. Message: Request failed with status code 422: {"message":"failed"}',
|
||||
});
|
||||
|
@ -721,7 +721,7 @@ export default function opsgenieTest({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: opsgenieActionId,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Status code: 422. Message: Request failed with status code 422: {"message":"failed"}',
|
||||
});
|
||||
|
|
|
@ -210,7 +210,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Sub action "invalidAction" is not registered. Connector id: ${tinesActionId}. Connector name: Tines. Connector type: .tines`,
|
||||
});
|
||||
});
|
||||
|
@ -229,7 +229,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [storyId]: expected value of type [number] but got [undefined])',
|
||||
});
|
||||
|
@ -249,7 +249,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Invalid subActionsParams: [webhook] or [webhookUrl] expected but got none',
|
||||
});
|
||||
|
@ -273,7 +273,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [webhook.storyId]: expected value of type [number] but got [undefined])',
|
||||
});
|
||||
|
@ -297,7 +297,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [webhook.name]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -321,7 +321,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [webhook.path]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -345,7 +345,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
status: 'error',
|
||||
retry: true,
|
||||
message: 'an error occurred while running the action',
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [webhook.secret]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -503,7 +503,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: tinesActionId,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: 'Status code: 422. Message: API Error: Unprocessable Entity',
|
||||
});
|
||||
});
|
||||
|
@ -525,7 +525,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: tinesActionId,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: 'Status code: 422. Message: API Error: Unprocessable Entity',
|
||||
});
|
||||
});
|
||||
|
@ -545,7 +545,7 @@ export default function tinesTest({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: tinesActionId,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: 'Status code: 422. Message: API Error: Unprocessable Entity',
|
||||
});
|
||||
});
|
||||
|
|
|
@ -170,7 +170,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: res.body.id,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message:
|
||||
'Request validation failed (Error: [id]: expected value of type [string] but got [undefined])',
|
||||
});
|
||||
|
@ -251,7 +251,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: res.body.id,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Sub action \"notRegistered\" is not registered. Connector id: ${res.body.id}. Connector name: Test: Sub action connector. Connector type: test.sub-action-connector`,
|
||||
});
|
||||
});
|
||||
|
@ -272,7 +272,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: res.body.id,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Method \"notAFunction\" does not exists in service. Sub action: \"notAFunction\". Connector id: ${res.body.id}. Connector name: Test: Sub action connector. Connector type: test.sub-action-connector`,
|
||||
});
|
||||
});
|
||||
|
@ -293,7 +293,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: res.body.id,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: `Method \"notExist\" does not exists in service. Sub action: \"notExist\". Connector id: ${res.body.id}. Connector name: Test: Sub action connector. Connector type: test.sub-action-connector`,
|
||||
});
|
||||
});
|
||||
|
@ -317,7 +317,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
retry: true,
|
||||
connector_id: res.body.id,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
service_message: 'You should register at least one subAction for your connector type',
|
||||
});
|
||||
});
|
||||
|
|
|
@ -133,7 +133,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
service_message: `expected failure for ${ES_TEST_INDEX_NAME} ${reference}`,
|
||||
retry: true,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
});
|
||||
|
||||
await validateEventLog({
|
||||
|
@ -329,7 +329,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
message: 'an error occurred while running the action',
|
||||
serviceMessage: `expected failure for ${ES_TEST_INDEX_NAME} ${reference}`,
|
||||
retry: true,
|
||||
errorSource: TaskErrorSource.USER,
|
||||
errorSource: TaskErrorSource.FRAMEWORK,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue