lambda-error-sns-sender
Advanced tools
Comparing version 0.0.52 to 0.0.53
@@ -132,5 +132,4 @@ import { awscdk } from 'projen'; | ||
], | ||
}), | ||
console.log(); | ||
}); | ||
project.synth(); |
17
API.md
@@ -5,7 +5,16 @@ # Lambda Error SNS Sender | ||
How does it work: | ||
- Lambda is subscribed to the SNS topic where you receive your alarms. There is a message body subscription filter that limits errors based on the Lambda error metric. If you defied your metic in some other way, not the default one, you will have to change that filter. | ||
- Lambda analyzes the message, finds a log of the failed Lambda, and queries the log for the period that the metic was configured, plus some additional safety time, so we do not miss that error message. It extracts just a number of errors that can fit in one SNS message. | ||
-Lambda sends errors to the same SNS you use for alerts. So apart from the common Alarm message, you will receive an additional one with error messages. | ||
How does it work? | ||
1. **Lambda is subscribed to the SNS topic where you receive your alarms.** There is a message body subscription filter that limits errors based on the Lambda error metric. You must change the filter if you defied your metric in some other way, not the default one. | ||
1. **Lambda analyzes the message**, finds a log of the failed Lambda, and queries the log group for the period that the metric was configured, plus some additional safety time, so we do not miss that error message. It extracts just a number of errors that can fit in one SNS message. | ||
1. **Lambda sends errors to the same SNS** that you use for alerts. So, apart from the Alarm message for changing the error state, you will receive an additional one with detailed error messages. | ||
![lambda-error-sns-sender](lambda-error-sns-sender.png) | ||
- **[CDK construct](https://constructs.dev/packages/lambda-error-sns-sender)** | ||
If you are building your system with CDK (or [SST](https://sst.dev/)). Available for TypeScript, Java, C#, Python, and Go. | ||
- **[CloudFormation](https://lambda-error-sns-sender.s3.eu-west-1.amazonaws.com/lambda-error-sns-sender.yaml)** | ||
For existing solutions, so you do not have to modify them. You deploy and point to the existing SNS used for CloudWatch alarms. | ||
**If you are interested how to use it and how was build see the [blog post](https://www.serverlesslife.com/live/Improving_CloudWatch_Alarms_for_Lambda_Errors.html).** | ||
# API Reference <a name="API Reference" id="api-reference"></a> | ||
@@ -12,0 +21,0 @@ |
@@ -107,3 +107,2 @@ import { Buffer } from 'node:buffer'; | ||
//const joinedLogs = `LAMBDA ${functionName} ERRORS:\n\n${logs.join('\n')}`; | ||
const joinedLogs = logs.join('\n'); | ||
@@ -110,0 +109,0 @@ |
@@ -92,9 +92,2 @@ "use strict"; | ||
exports.CloudFormationExportStack = CloudFormationExportStack; | ||
const app = new aws_cdk_lib_1.App(); | ||
new CloudFormationExportStack(app, 'lambda-error-sns-sender-cf', { | ||
synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer({ | ||
generateBootstrapVersionRule: false, | ||
}), | ||
}); | ||
app.synth(); | ||
function setNodeNames(constructs, parentName) { | ||
@@ -117,2 +110,2 @@ let i = 0; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xvdWRGb3JtYXRpb25FeHBvcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY2xvdWRGb3JtYXRpb25FeHBvcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsNkNBTXFCO0FBQ3JCLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFDM0MsaURBQWlEO0FBQ2pELDJDQUEyQztBQUUzQyxtQ0FBK0M7QUFFL0MsTUFBYSx5QkFBMEIsU0FBUSxtQkFBSztJQUNsRCxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLFFBQW9CLEVBQUU7UUFDOUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxjQUFjLEdBQUcsQ0FBQyxDQUFDO1FBQ3pCLE1BQU0sU0FBUyxHQUFnQixFQUFFLENBQUM7UUFDbEMsTUFBTSxjQUFjLEdBQXFDLEVBQUUsQ0FBQztRQUU1RCxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLElBQUksY0FBYyxFQUFFLENBQUMsRUFBRSxFQUFFO1lBQ3hDLE1BQU0sZ0JBQWdCLEdBQUcsSUFBSSwwQkFBWSxDQ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vZGUuaWR9YFxuICAgICAgICA6IGNvbnN0cnVjdC5ub2RlLmlkO1xuICAgICAgY29uc3RydWN0Lm5vZGUuZGVmYXVsdENoaWxkLm92ZXJyaWRlTG9naWNhbElkKG5ld1BhcmVudE5hbWUpO1xuICAgIH1cblxuICAgIGlmIChjb25zdHJ1Y3QgaW5zdGFuY2VvZiBsYW1iZGEuQ2ZuUGVybWlzc2lvbikge1xuICAgICAgY29uc3RydWN0Lm92ZXJyaWRlTG9naWNhbElkKGAke25ld1BhcmVudE5hbWV9UGVybWlzc2lvbiR7aX1gKTtcbiAgICAgIGkrKztcbiAgICB9XG5cbiAgICBzZXROb2RlTmFtZXMoY29uc3RydWN0Lm5vZGUuY2hpbGRyZW4sIG5ld1BhcmVudE5hbWUpO1xuICB9XG59XG4iXX0= |
@@ -59,3 +59,3 @@ "use strict"; | ||
_a = JSII_RTTI_SYMBOL_1; | ||
LambdaErrorSnsSender[_a] = { fqn: "lambda-error-sns-sender.LambdaErrorSnsSender", version: "0.0.52" }; | ||
LambdaErrorSnsSender[_a] = { fqn: "lambda-error-sns-sender.LambdaErrorSnsSender", version: "0.0.53" }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSw2QkFBNkI7QUFDN0IsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUMzQyxpREFBaUQ7QUFDakQsMkNBQTJDO0FBRTNDLGtFQUFrRTtBQUNsRSwyQ0FBdUM7QUFVdkMsTUFBYSxvQkFBcUIsU0FBUSxzQkFBUztJQUNqRCxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWdDO1FBQ3hFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsSUFBSSxDQU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7XG5cbiAgICAgIHNuc1RvcGljLmdyYW50UHVibGlzaChzbnNFcnJvckZ1bmMpO1xuICAgIH1cbiAgfVxufVxuIl19 |
@@ -44,7 +44,7 @@ { | ||
"@types/node": "^16", | ||
"@typescript-eslint/eslint-plugin": "^5", | ||
"@typescript-eslint/parser": "^5", | ||
"@typescript-eslint/eslint-plugin": "^6", | ||
"@typescript-eslint/parser": "^6", | ||
"aws-cdk-lib": "2.70.0", | ||
"constructs": "10.0.5", | ||
"esbuild": "^0.19.2", | ||
"esbuild": "^0.19.4", | ||
"esbuild-runner": "^2.2.2", | ||
@@ -54,16 +54,16 @@ "eslint": "^8", | ||
"eslint-import-resolver-node": "^0.3.9", | ||
"eslint-import-resolver-typescript": "^3.6.0", | ||
"eslint-plugin-import": "^2.28.0", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint-plugin-import": "^2.28.1", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"jsii": "^5.1.9", | ||
"jsii-diff": "^1.87.0", | ||
"jsii-docgen": "^9.1.2", | ||
"jsii-pacmak": "^1.87.0", | ||
"jsii-diff": "^1.89.0", | ||
"jsii-docgen": "^9.2.2", | ||
"jsii-pacmak": "^1.89.0", | ||
"jsii-rosetta": "^5.1.9", | ||
"npm-check-updates": "^16", | ||
"prettier": "^3.0.1", | ||
"projen": "^0.72.11", | ||
"prettier": "^3.0.3", | ||
"projen": "^0.73.38", | ||
"standard-version": "^9", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6" | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -89,3 +89,3 @@ "peerDependencies": { | ||
"license": "Apache-2.0", | ||
"version": "0.0.52", | ||
"version": "0.0.53", | ||
"types": "lib/index.d.ts", | ||
@@ -92,0 +92,0 @@ "stability": "stable", |
@@ -5,5 +5,15 @@ # Lambda Error SNS Sender | ||
How does it work: | ||
- Lambda is subscribed to the SNS topic where you receive your alarms. There is a message body subscription filter that limits errors based on the Lambda error metric. If you defied your metic in some other way, not the default one, you will have to change that filter. | ||
- Lambda analyzes the message, finds a log of the failed Lambda, and queries the log for the period that the metic was configured, plus some additional safety time, so we do not miss that error message. It extracts just a number of errors that can fit in one SNS message. | ||
-Lambda sends errors to the same SNS you use for alerts. So apart from the common Alarm message, you will receive an additional one with error messages. | ||
How does it work? | ||
1. **Lambda is subscribed to the SNS topic where you receive your alarms.** There is a message body subscription filter that limits errors based on the Lambda error metric. You must change the filter if you defied your metric in some other way, not the default one. | ||
1. **Lambda analyzes the message**, finds a log of the failed Lambda, and queries the log group for the period that the metric was configured, plus some additional safety time, so we do not miss that error message. It extracts just a number of errors that can fit in one SNS message. | ||
1. **Lambda sends errors to the same SNS** that you use for alerts. So, apart from the Alarm message for changing the error state, you will receive an additional one with detailed error messages. | ||
![lambda-error-sns-sender](lambda-error-sns-sender.png) | ||
- **[CDK construct](https://constructs.dev/packages/lambda-error-sns-sender)** | ||
If you are building your system with CDK (or [SST](https://sst.dev/)). Available for TypeScript, Java, C#, Python, and Go. | ||
- **[CloudFormation](https://lambda-error-sns-sender.s3.eu-west-1.amazonaws.com/lambda-error-sns-sender.yaml)** | ||
For existing solutions, so you do not have to modify them. You deploy and point to the existing SNS used for CloudWatch alarms. | ||
**If you are interested how to use it and how was build see the [blog post](https://www.serverlesslife.com/live/Improving_CloudWatch_Alarms_for_Lambda_Errors.html).** |
@@ -140,3 +140,2 @@ import * as fs from 'fs'; | ||
Body: body, | ||
//ACL: 'public-read', | ||
}; | ||
@@ -143,0 +142,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
244512
36
941
18