atrayeen
atrayeen

Reputation: 101

Serverless Framework Secrets Error - An error occurred while calling one AWS dependency service

I am trying to access secret managers using Serverless secrets framework this way:

Approach1 works fine, but I get the below error with Approach2 on serverless deploy-

Cannot resolve serverless.yml: Variables resolution errored with:
  - Cannot resolve variable at "custom.lambdas.test.custom.supersecret": An error occurred while calling one AWS dependency service.

Serverless version - Framework Core: 2.69.1 (local) Plugin: 5.5.1 SDK: 4.3.0 Components: 3.18.1

The secrets are not replicated and only exist in us-east-1. Any idea what I could be doing wrong?

Upvotes: 10

Views: 3682

Answers (1)

joe recra
joe recra

Reputation: 119

Yesterday, I had the same error. Well, the error comes from serverless's version I was using. In my local environment, I had the version 2.3 and it works fine with the flag ~true after my secret_name ID, but in my CD I had version 3.*, and that was generating the error. After reading the docs, I searched:

Note: The method described below works by default in Serverless v3, but it requires the variablesResolutionMode: 20210326 option in v2.

So, if you're using v3 use:

ssm:/aws/reference/secretsmanager/my_secret_name

or

ssm:/aws/reference/secretsmanager/my_secret_name~true

instead

Upvotes: 9

Related Questions