Skip to content

Unable to set aws credentials in v3.2.0 #181

Closed
@blaxk

Description

@blaxk
const logger = winston.createLogger({
   transports: [
      new WinstonCloudWatch({
         name: `/my-log/${stage}`,
         logGroupName: `/aws/s3/${repoName}`,
         logStreamName: 'log-stream',
         awsRegion: 'ap-northeast-2',
         awsAccessKeyId: stage === 'prod' ? process.env.PROD_ACCESS_KEY_ID : process.env.DEV_ACCESS_KEY_ID,
         awsSecretKey: stage === 'prod' ? process.env.PROD_SECRET_ACCESS_KEY : process.env.DEV_SECRET_ACCESS_KEY
      })
   ]
})

In winston-cloudwatch v3.1.1 with aws-sdk v2 you could set the awsAccessKeyId, awsSecretKey options.
However, in winston-cloudwatch v3.2.0 using aws-sdk v3, even setting the awsAccessKeyId and awsSecretKey options causes the credentials error as shown below.

image

You're probably looking at the credentials set in your .aws/credentials file.
I want to be able to set the awsAccessKeyId and awsSecretKey in the winston-cloudwatch option, without the .aws/credentials file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions