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

update CloudwatchLogs credential object #192

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var WinstonCloudWatch = function(options) {
config = assign(config, options.awsOptions);
}

this.cloudwatchlogs = new CloudWatchLogs(config);
this.cloudwatchlogs = new CloudWatchLogs({credentials:config});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you instantiating the WinstonCloudWatch transport? When I do so via:

new WinstonCloudWatch({
  ...,
  awsAccessKeyId,
  awsSecretKey,
  awsRegion,
})

This fix doesn't work. Specifically because in CloudWatchLogsClientConfig, region is specified at the same level of credentials.

Additionally, I believe this proposed fix would break the transport for those who:

  1. only specify region and allow AWS SDK to pull creds from the IAM role
  2. specify the CloudWatchLogsClientConfig directly though awsOptions

Thus, I would propose something like changing line 40 to:

config = {
  credentials: {
    accessKeyId: awsAccessKeyId,
    secretAccessKey: awsSecretKey,
  },
  region: awsRegion
};

And this line back to its original

this.cloudwatchlogs = new CloudWatchLogs(config);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @nikhilrajaram, what do you think @yzpaul?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lazywithclass yes @nikhilrajaram is right according to the docs, I didn't notice that issue because all of my test cases were in the same region.

}

debug('constructor finished');
Expand Down