thomasmichaelwallace / serverless-better-credentials

Better AWS credentials resolution plugin for serverless
MIT License
54 stars 9 forks source link

Problems when using with serverless-domain-manager #25

Closed kdybicz closed 10 months ago

kdybicz commented 1 year ago

Describe the bug

This might not be directly related to your code, it's just a clash with a different library, but I thought you might want to know: https://github.com/amplify-education/serverless-domain-manager/issues/580

thomasmichaelwallace commented 1 year ago

Hi @kdybicz - this is because (since v7, see change-log) serverless-domain-manager is now using aws-sdk v3, which is incompatible with the way this plugin provides credentials the the serverless framework.

My only suggestion is to either use something like https://github.com/99designs/aws-vault to handle your account changes (this sets the AWS_X environment variables, which is the most universal way), or downgrade serverless-domain-manager to 6.4.4.

kdybicz commented 1 year ago

Hi @thomasmichaelwallace! Thank you for the reply. I was able to make it all work with serverless-domain-manager downgraded to version 7.0.2. So far I'm stuck with such a configuration, later... we will see. I've created this issue just to let you know about potential problems.

Feel free to close this ticket if you think it's not needed or leave it for others.

thomasmichaelwallace commented 10 months ago

For what it's worth, a work around is just to create the credential file, so you can do the following as part of your ci/cd action flow:

mkdir -p ~/.aws
rm -rf ~/.aws/credentials
echo "[YOUR_PROFILE_NAME]" >> ~/.aws/credentials
echo "aws_access_key_id = ${AWS_ACCESS_KEY_ID}" >> ~/.aws/credentials
echo "aws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" >> ~/.aws/credentials
echo "aws_session_token = ${AWS_SESSION_TOKEN}" >> ~/.aws/credentials
echo "region = eu-west-1" >> ~/.aws/credentials
echo "output = json" >> ~/.aws/credentials
thomasmichaelwallace commented 10 months ago

I've now added that workaround to the readme: https://github.com/thomasmichaelwallace/serverless-better-credentials?tab=readme-ov-file#troubleshooting

I'll close this issue for now, but feel free to re-open if you have any trouble.