Slack webhook require "text" field to be send. What is actually send is SNS parsed "message" Record which do not contain "text". This causes Status 400 and message is never send to webhook.
Reproduced on version 1.0.1
debug log from cloudwatch, notice POST data not compatible with slack and slack webhook:
{
"timestamp": "2025-06-02T13:05:44.020Z",
"level": "ERROR",
"requestId": "879e8ca7-6869-4ab4-9a6d-e8f732fdd98c",
"message": {
"errorType": "Error",
"errorMessage": "An HTTP protocol error occurred: statusCode = 400",
"stackTrace": [
"Error: An HTTP protocol error occurred: statusCode = 400",
" at httpErrorWithOriginal (/var/task/index.js:14872:35)",
" at IncomingWebhook2.send (/var/task/index.js:15039:54)",
" at process.processTicksAndRejections (node:internal/process/task_queues:105:5)",
" at async Promise.all (index 0)"
],
"code": "slack_webhook_http_error",
"original": {
"message": "Request failed with status code 400",
"name": "AxiosError",
"stack": "AxiosError: Request failed with status code 400\n at settle2 (/var/task/index.js:12886:16)\n at IncomingMessage.handleStreamEnd (/var/task/index.js:13703:15)\n at IncomingMessage.emit (node:events:530:35)\n at endReadableNT (node:internal/streams/readable:1698:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n at Axios3.request (/var/task/index.js:14494:45)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async IncomingWebhook2.send (/var/task/index.js:15035:28)\n at async Promise.all (index 0)",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"adapter": [
"xhr",
"http",
"fetch"
],
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {},
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"User-Agent": "@slack:webhook/7.0.5 node/22.15.0 linux/5.10.236-249.934.amzn2.aarch64",
"Content-Length": "1065",
"Accept-Encoding": "gzip, compress, deflate, br"
},
"baseURL": "<REDACTED>",
"maxRedirects": 0,
"proxy": false,
"method": "post",
"url": "<REDACTED>",
"data": "{\"timeout\":0,\"text\":{\"account\":\"<REDACTED>\",\"detailType\":\"CodePipeline Stage Execution State Change\",\"region\":\"us-east-1\",\"source\":\"aws.codepipeline\",\"time\":\"2025-06-02T13:05:31Z\",\"notificationRuleArn\":\"arn:aws:codestar-notifications:us-east-1:<REDACTED>:notificationrule/37e456e448f3c7da068e722d5c2e54c6fcbe27b3\",\"detail\":{\"pipeline\":\"aaSwBuildSystemPipeline-v1_test\",\"execution-id\":\"5343a8fe-f539-49cf-ae75-17e076ddad45\",\"start-time\":\"2025-06-02T13:04:07.324Z\",\"stage\":\"Build\",\"state\":\"FAILED\",\"version\":1,\"pipeline-execution-attempt\":0},\"resources\":[\"arn:aws:codepipeline:us-east-1:<REDACTED>:aaSwBuildSystemPipeline-v1_test\"],\"additionalAttributes\":{\"failedActionCount\":1,\"failedActions\":[{\"action\":\"Build\",\"additionalInformation\":\"Build terminated with state: FAILED. Phase: BUILD, Code: COMMAND_EXECUTION_ERROR, Message: Error while executing command: python3 -m converter $SRC_CVENT_DATA_REPO_NAME/data $SRC_DOCEBO_DATA_REPO_NAME/data $SRC_WP_DATA_REPO_NAME/data source_data $OUT_DATA_REPO_NAME/data. Reason: exit status 1\"}]}}}",
"allowAbsoluteUrls": true
},
"code": "ERR_BAD_REQUEST",
"status": 400
}
}
}
Slack webhook require "text" field to be send. What is actually send is SNS parsed "message" Record which do not contain "text". This causes Status 400 and message is never send to webhook.
Reproduced on version 1.0.1
debug log from cloudwatch, notice POST data not compatible with slack and slack webhook: