How to get secret from Secret Manager in serverless

I configured a secret to my RDS database. Its name is: qa/aurora

I am trying to make the reference on my serverless.yml in the environment settings like this:

DB: ${ssm:/aws/reference/secretsmanager/qa/aurora~true}

I want to use this DB environment variable to set the user and password to my Aurora database.

The problem is that I am getting this error:

ServerlessError: An error occurred: testLambdaFunction - Properties validation failed for resource testLambdaFunction with message:
#/Environment/Variables/DB: expected type: String, found: JSONObject.
at C:\Users\fer\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:94:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async AwsDeploy.update (C:\Users\fer\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:144:5)

According to the Serverless docs, it should be working fine with getting a JSONObject.

What I am missing to make this work?

PS: Why should I add ~true at the end of the string to find the secret? If I remove this value i get the error:

A valid SSM parameter to satisfy the declaration ‘ssm:/aws/reference/secretsmanager/qa/aurora’ could not be found


I have the same issue, were you able to find a solution by any chance?

I have the same error. Have you found a resolution? If so, would you post it?

Thank you!

With SSM Parameter store values this ~true indicated that the value was of type SecureString and should be decrypted before being returned.

The syntax for referencing SSM parameters and secrets manager has changed since you last post, would be worth revisiting the docs