Skip to content
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

feat(log): Log AWS SDK calls in debug mode #5604

Merged
merged 1 commit into from
Dec 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/plugins/aws/provider/awsProvider.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ class AwsProvider {


Object.assign(this.naming, naming); Object.assign(this.naming, naming);


// Activate AWS SDK loggin
if (process.env.SLS_DEBUG) {
AWS.config.logger = this.serverless.cli;
}

// Use HTTPS Proxy (Optional) // Use HTTPS Proxy (Optional)
const proxy = process.env.proxy const proxy = process.env.proxy
|| process.env.HTTP_PROXY || process.env.HTTP_PROXY
Expand Down
15 changes: 15 additions & 0 deletions lib/plugins/aws/provider/awsProvider.test.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ describe('AwsProvider', () => {
expect(awsProvider.provider).to.equal(awsProvider); expect(awsProvider.provider).to.equal(awsProvider);
}); });


it('should have no AWS logger', () => {
expect(awsProvider.sdk.config.logger).to.be.undefined;
});

it('should set AWS logger', () => {
const BK_SLS_DEBUG = process.env.SLS_DEBUG;
process.env.SLS_DEBUG = 'true';
const newAwsProvider = new AwsProvider(serverless, options);

expect(typeof newAwsProvider.sdk.config.logger).to.not.equal('undefined');

// reset env
process.env.SLS_DEBUG = BK_SLS_DEBUG;
});

it('should set AWS proxy', () => { it('should set AWS proxy', () => {
process.env.proxy = 'http://a.b.c.d:n'; process.env.proxy = 'http://a.b.c.d:n';
const newAwsProvider = new AwsProvider(serverless, options); const newAwsProvider = new AwsProvider(serverless, options);
Expand Down