webiny-js
webiny-js copied to clipboard
Post deployment hooks not using the AWS profile specified in .env file.
Version
5.37.0
Operating System
MacOs
Browser
Chrome
What are the steps to reproduce this bug?
Configure a project with an AWS profile that isn't the default one. Deploy the project. Post deployment hook "data migrations Lambda function..." fails to run due to permissions error (it's using the default profile).
What is the expected behavior?
The build/deployment hooks should use the specified AWS profile
What do you see instead?
No response
Additional information
No response
Possible solution
No response
In my case the hook-before-deploy hook named hook-before-deploy-aws-credentials is failing because I don't use the default profile, when running yarn webiny deploy <app> --env <env>:
Version: 5.37.4 Operating System: Linux Browser: not relevant, since this issue is in the cli
It seems, that aws sdk sts client, doesn' respect the AWS_PROFILE environment variable to load the profile's config:
https://github.com/webiny/webiny-js/blob/5ed6b50a35f87beeb2f62a021bda9bd7af6040f7/packages/cwp-template-aws/cli/aws/checkCredentials.js#L8-L15
Interestingly running yarn webiny deploy --env <env> (deploy all apps together) doesn't fail for me.