Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
🐛 Fix referencing static functions
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubMatejka committed Nov 14, 2017
1 parent 56de396 commit 1b06044
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keboola/serverless-papertrail-logging",
"version": "1.0.1",
"version": "1.0.2",
"description": "Serverless Plugin for log delivery from CloudWatch Logs to Papertrail using a lambda function with log groups subscription",
"main": "src/index.js",
"repository": "https://github.com/keboola/serverless-papertrail-logging",
Expand Down
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PapertrailLogging {
}

getEnvFilePath() {
return path.join(this.serverless.config.servicePath, this.getFunctionFilename());
return path.join(this.serverless.config.servicePath, PapertrailLogging.getFunctionName());
}

packageCreateDeploymentArtifacts() {
Expand All @@ -44,7 +44,7 @@ class PapertrailLogging {
PapertrailLoggerLogGroup: {
Type: "AWS::Logs::LogGroup",
Properties: {
LogGroupName: `/aws/lambda/${this.service.service}-${this.service.provider.stage}-${this.getFunctionName()}`
LogGroupName: `/aws/lambda/${this.service.service}-${this.service.provider.stage}-${PapertrailLogging.getFunctionName()}`
}
}
}
Expand All @@ -58,9 +58,9 @@ class PapertrailLogging {
.replace('%papertrailHostname%', this.service.service)
.replace('%papertrailProgram%', this.service.provider.stage);
fs.writeFileSync(path.join(functionPath, 'handler.js'), handlerFunction);
this.service.functions[this.getFunctionName()] = {
handler: `${this.getFunctionFilename()}/handler.handler`,
name: `${this.service.service}-${this.service.provider.stage}-${this.getFunctionName()}`,
this.service.functions[PapertrailLogging.getFunctionName()] = {
handler: `${PapertrailLogging.getFunctionName()}/handler.handler`,
name: `${this.service.service}-${this.service.provider.stage}-${PapertrailLogging.getFunctionName()}`,
tags: _.has(this.service.provider, 'stackTags') ? this.service.provider.stackTags : {},
events: []
};
Expand All @@ -69,7 +69,7 @@ class PapertrailLogging {
packageCompileEvents() {
this.serverless.cli.log('Creating log subscriptions...');

const loggerLogicalId = this.provider.naming.getLambdaLogicalId(this.getFunctionName());
const loggerLogicalId = this.provider.naming.getLambdaLogicalId(PapertrailLogging.getFunctionName());

_.each(this.service.provider.compiledCloudFormationTemplate.Resources, (item, key) => {
if (_.has(item, 'Type') && item.Type === 'AWS::Logs::LogGroup') {
Expand All @@ -95,7 +95,7 @@ class PapertrailLogging {

const functions = this.service.getAllFunctions();
functions.forEach((functionName) => {
if (functionName !== this.getFunctionName()) {
if (functionName !== PapertrailLogging.getFunctionName()) {
const functionData = this.service.getFunction(functionName);
const normalizedFunctionName = this.provider.naming.getNormalizedFunctionName(functionName);
_.merge(
Expand Down

0 comments on commit 1b06044

Please sign in to comment.