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
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+20 −0
Diff settings

Always

Just for now

@@ -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
@@ -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);
ProTip! Use n and p to navigate between commits in a pull request.