rrahul963 / serverless-create-global-dynamodb-table

serverless plugin that would create global dynamodb tables for specified tables
Apache License 2.0
25 stars 17 forks source link

Experiencing an error when creating global table and createStack is false #18

Closed funkel1989 closed 4 years ago

funkel1989 commented 4 years ago

Error

CreateGlobalTable: Starting setting up global tables...
CreateGlobalTable: Global table doesn't exist...
CreateGlobalTable: Creating new table devtable in us-east-2 region...
CreateGlobalTable: Creating new table devtable in us-west-2 region...
CreateGlobalTable: Failed to setup global table. Error There were 2 validation errors:
* UnexpectedParameter: Unexpected key 'NumberOfDecreasesToday' found in params.GlobalSecondaryIndexes[0].ProvisionedThroughput
* UnexpectedParameter: Unexpected key 'NumberOfDecreasesToday' found in params.GlobalSecondaryIndexes[1].ProvisionedThroughput

These tables use bill per request and have no ProvisionedThroughput on the table or the GSI

Table Example:

Table:
      Type: AWS::DynamoDB::Table
      Properties:
        PointInTimeRecoverySpecification:
          PointInTimeRecoveryEnabled: true
        StreamSpecification:
          StreamViewType: NEW_AND_OLD_IMAGES
        TableName: ${self:custom.serviceName}
        AttributeDefinitions:
          - AttributeName: Id
            AttributeType: S
          - AttributeName: AnotherId
            AttributeType: S
          - AttributeName: CreatedDateTime
            AttributeType: S
          - AttributeName: YetAnotherId
            AttributeType: S
          - AttributeName: somethingelsesId
            AttributeType: S
          - AttributeName: fakeId
            AttributeType: S
        KeySchema:
          - AttributeName: AnotherId
            KeyType: HASH
          - AttributeName: CreatedDateTime
            KeyType: RANGE
        BillingMode: PAY_PER_REQUEST
        GlobalSecondaryIndexes:
          - IndexName: Id_AnotherId_IDX
            KeySchema:
              - AttributeName: AnotherId_YetAnotherId
                KeyType: HASH
              - AttributeName: CreatedDateTime
                KeyType: RANGE
            Projection:
              ProjectionType: 'ALL'
          - IndexName: AnotherId_YetAnotherId_IDX
            KeySchema:
              - AttributeName: Id
                KeyType: HASH
              - AttributeName: FakeId
                KeyType: RANGE
            Projection:
              ProjectionType: 'ALL'

Obviously the above field names and everything going along with it has been made up but the actual implementation works when the table is deployed without this plugin.

I am also able to create Global tables from the aws Console without an issue.

Please assist.

rrahul963 commented 4 years ago

@funkel1989 - can you please share the complete serverless.yml file? I haven't seen this issue before so if i have the actual yaml file, then it'll help me debug the issue.

rrahul963 commented 4 years ago

@funkel1989 - ia m closing this issue for now. Please open a new one with yaml file if you face this issue again.

funkel1989 commented 4 years ago

@rrahul963 Sorry i failed to follow up here. Unfortunately i can't share the entire yaml for privacy reasons. I can share edited pieces of it though is there is something specific you are looking for.

plugins:

These are the plugins we are using if that helps. The service this is being deployed for is typescript and webpack handles the build for us but i don't believe that would matter here.

there is nothing else really different from the standard serverless config other then what i've mentioned.

funkel1989 commented 4 years ago

Also if it helps, These are the versions of serverless we were using:

"serverless": "^1.73.1",
"serverless-domain-manager": "^4.1.1",
"serverless-offline": "^6.4.0",
"serverless-plugin-aws-alerts": "^1.5.2",
"serverless-plugin-optimize": "^4.1.4-rc.1",
"serverless-plugin-tracing": "^2.0.0",
"serverless-pseudo-parameters": "^2.5.0",
austeny commented 12 months ago

I am running into this same issue. It looks like the plugin is defining ProvisionedThroughput even though its an optional property. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-globalsecondaryindex.html. Since ProvisionedThroughput isn't defined in the Global Secondary Index it chokes. Not sure if that helps provide any clarity. It looks to be specific when you are using GlobalSecondaryIndexes with this plugin.