serverless / template

Compose & provision a collection of Serverless Components
https://serverless.com
Apache License 2.0
10 stars 6 forks source link

Remove faulty ramda function #2

Closed austencollins closed 5 years ago

austencollins commented 5 years ago

When you have a serverless.yml that contains inputs with objects in arrays, the arrays are turned into objects by a ramda function being used. This causes the component to crash, due to incorrect formatting. Here is the edge-case of this ramda function: https://github.com/ramda/ramda/issues/1816

For example, deploying any instance of the aws-dynamodb component will fail because it requires arrays with objects to define its schema. However, those arrays will be turned into objects, and the aws sdk will throw an error, causing the component deployment to crash:

# serverless.yml

database:
  component: '@serverless/aws-dynamodb@2.0.0'
  inputs:
    region: us-east-1
    attributeDefinitions:
      - AttributeName: 'pk'
        AttributeType: 'S'
      - AttributeName: 'sk'
        AttributeType: 'S'
    keySchema:
      - AttributeName: 'pk'
        KeyType: 'HASH'
      - AttributeName: 'sk'
        KeyType: 'RANGE'

To fix this, I just used the this.update(value) method that came with the traverse module which is already being used. This seems to work well.