-
Notifications
You must be signed in to change notification settings - Fork 105
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
Unable to set aws credentials in v3.2.0 #181
Comments
Just to add additional context here, this is also an issue 4.0.1 - and last worked in 3.1.1 for me. As a workaround, if using Elastic Beanstalk, attaching the Cloudwatch Full policy to the account running Beanstalk got things working again for me. |
What is the correct way to set the AWS credentials now?
As per the AWS documentation, but I still receive the same error ( And when I tried to go back to 3.1.1, I now receive a |
Ok, digging more into it, the However digging even further, I seem to have found an override for the file path location (found in So setting e.g. I've also found that you could set the credentials directly in your environment variable, with |
In our case, we are already using the AWS SDK and AWS_* env vars. We need to specifically pass in values pulled from alternately-named env vars. 3.1.1 works for our needs. |
this still seems to be an issue in 6.x -- has anyone looked into why to open a pull request? |
Sorry for being so late, I managed to get some time to work on this given the time you've been waiting. I followed this guide but unfortunately I am not able to replicate, so my suspect is that I did not correctly understand the issue here; this is what I am doing:
const WinstonCloudWatch = require('../index')
const logger = winston.createLogger({
transports: [
new WinstonCloudWatch({
name: `log`,
logGroupName: `group-name`,
logStreamName: 'stream-name',
awsRegion: 'eu-west-2'
})
]
})
logger.error('2'); I got |
the issue is that defining the API credentials in the initialization class is ignored if you have them set within if that's the direction of then package that's fine, I built a work around that generates the credentials files in docker and I know that assigning roles to the running container is the appropriate runtime solution -- just juggling priority as you do in a startup |
simple steps to reproduce:
Attempt to write a log. Code will fail with error somehow this is function call is using the default credentials, despite passing in (and tracing) the fact that it is using custom credentials) |
Submitted pull request to fix the issue: #192 |
I have been able to circumvent this by specifying the new WinstonCloudWatch({
...,
awsOptions: {
credentials: {
accessKeyId,
secretAccessKey,
},
region,
}
}) |
Thanks @nikhilrajaram, It worked for me too |
Thanks @nikhilrajaram @lazywithclass |
Done https://github.com/lazywithclass/winston-cloudwatch/blob/master/README.md#credentials Thanks for the help everyone, it's much appreciated! |
this solution works fine. Thanks! |
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
andawsSecretKey
options causes the credentials error as shown below.You're probably looking at the credentials set in your
.aws/credentials
file.I want to be able to set the
awsAccessKeyId
andawsSecretKey
in the winston-cloudwatch option, without the.aws/credentials
file.The text was updated successfully, but these errors were encountered: