Closed danemauland closed 2 years ago
Hi - thanks for reporting.
I don't actually use serverless for deployment - but I think you're analysis is right, they're making use of the (also) undocumented cachedCredentials
property to override the default resolution mechanism.
serverless-better-credentials@1.1.2
should fix this.
I've put a guard in, and a warning. This does mean that you won't get serverless-better-credentials
resolution when you run it in the serverless ci/cd pipeline, but presumably this is OK because they're already taking control of the credential resolution...
Describe the bug When using Serverless's CI/CD feature to deploy, serverless-better-credentials raises a "TypeError: Cannot read property 'getPromise' of undefined" in the init method of the ServerlessBetterCredentials class. This happens even when serverless-better-credentials as the first plugin listed.
To Reproduce Steps to reproduce the behavior:
Expected behavior I expected the build to succeed and for serverless-better-credentials to not throw an error.
Screenshots![image](https://user-images.githubusercontent.com/65823442/165161230-25d04086-c263-407d-a83b-966bcb20fc47.png)
Desktop (please complete the following information):
Additional context I think that when using the CI/CD pipeline, serverless may be initializing the provider.cachedCredentials variable (used in the getCredentials method) before serverless-better-credentials is able to. This leads to the cachedCredentials being returned before the getCredentials method can format it, so it is not in the structure expected by the ServerlessBetterCredentials init method.