-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Serverless naming module to format log group name #7
Use Serverless naming module to format log group name #7
Conversation
@@ -22,6 +22,8 @@ class LogForwardingPlugin { | |||
this.serverless.service.resources = { | |||
Resources: {}, | |||
}; | |||
} else if (this.serverless.service.resources.Resources === undefined) { | |||
this.serverless.service.resources.Resources = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updates the resources object if it doesn\'t exist
test was failing due to this.serverless.service.resources
being instantiated by Serverless framework but didn't have Resources
property set.
package.json
Outdated
}, | ||
"scripts": { | ||
"test": "node ./node_modules/istanbul/lib/cli.js cover _mocha -- -R spec && node ./node_modules/istanbul/lib/cli.js check-coverage --line 70 coverage/coverage.json", | ||
"test": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec && node ./node_modules/istanbul/lib/cli.js check-coverage --line 70 coverage/coverage.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes following error I was getting on Windows:
...\node_modules\.bin\_mocha.CMD:1
(function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" (
^
SyntaxError: Invalid or unexpected token
test/index-test.js
Outdated
}, | ||
functions: { | ||
testFunctionOne: { | ||
name: 'functionOne', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function names are meant to override deployed function name and are not required if you want to have conventional service-stage-functionName
format.
c2b5477
to
a7cb607
Compare
also if function names contain dashes, deploy will fail. |
@domaslasauskas @jconstance-amplify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for this PR. We can merge this if you could fix those merge conflicts. Thanks!
Hey @domaslasauskas, thanks for doing this as I am running into the same issue 😄. Any thoughts on fixing these merge conflicts? Let me know if I can help out. |
nice! looking forward to the release including this one |
@domaslasauskas do you have time to resolve the conflicts here? If not I'm happy help |
This change allows others to change naming convention and keeps naming consistent with Serverless framework. Previously creating subscription filters would fail if log groups naming convention was changed.
acf942b
to
f65178f
Compare
I've rebased changes on latest master to keep clean history for this PR. Please review this again @aoskotsky-amplify |
@domaslasauskas Looks good. Thanks for the PR! Sorry about the delayed review |
There is an issue with this plugin when using custom naming convention by overriding naming module in AWS provider in Serverless. This PR uses naming module when forming
logGroupName
.I had to update tests to use actual Serverless instance with AWS provider plugin.
I've also had to remove explicit function names from test configuration as they are used to override function names for deployed lambdas.