serverless-iam-roles-per-function icon indicating copy to clipboard operation
serverless-iam-roles-per-function copied to clipboard

Configuration error: at 'provider.iam.role.statements.1.Action.0': must be string

Open hari5udhan opened this issue 3 years ago • 1 comments

provider: name: aws runtime: nodejs12.x stage: dev region: ap-south-1 iam: role: statements: - Effect: Allow Action: - excute-api:Invoke Resource: arn:aws:execute-api:::* - Effect: Allow Action: - dynamodb: UpdateItem - dynamodb: PutItem Resource: arn:aws*****************

Console Error is Error: Configuration error: at 'provider.iam.role.statements.1.Action.0': must be string at 'provider.iam.role.statements.1.Action.1': must be string

Learn more about configuration validation here: http://slss.io/configuration-validation

hari5udhan avatar Nov 23 '22 18:11 hari5udhan

IAM actions are on the form service:action. In your example however, you have a space after the colon, making this into an object per the YAML specification. If converting your YAML to JSON, you would see that it has become:

"action": [{"dynamodb": "UpdateItem"}, {"dynamodb": "PutItem"}]

instead of

"action": ["dynamodb:UpdateItem", "dynamodb:PutItem"]

Removing the space should do the trick.

Action:
  - dynamodb:UpdateItem
  - dynamodb:PutItem

Sometimes it's also wise to quote strings containing special characters in YAML.

henhal avatar Apr 17 '23 06:04 henhal