Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property Projection cannot be empty

I am trying to create a table using serverless framework and even though I have specified Projection for the GSI, serverless is complaining that property Projection cannot be empty. Am I getting the syntax wrong? If I remove the GSI section it works pretty fine.

Table1: 
  Type: "AWS::DynamoDB::Table"
  Properties: 
    AttributeDefinitions: 
    - AttributeName: "uid"
      AttributeType: "S"
    - AttributeName: "bid"
      AttributeType: "S"
    KeySchema: 
    - AttributeName: "uid"
      KeyType: "HASH"
    - AttributeName: "bid"
      KeyType: "RANGE"
    GlobalSecondaryIndexes:
    - IndexName: "bid-uid-index"
    - KeySchema:
      - AttributeName: "bid"
        KeyType: "HASH"
      - AttributeName: "uid"
        KeyType: "RANGE"
    - Projection: 
      - ProjectionType: "ALL"
    - ProvisionedThroughput:
        ReadCapacityUnits: 1
        WriteCapacityUnits: 1
    ProvisionedThroughput: 
      ReadCapacityUnits: 1
      WriteCapacityUnits: 1
    TableName: "Table1"
like image 242
Prabhat Avatar asked Dec 05 '25 11:12

Prabhat


1 Answers

Never mind, my syntax was wrong

GlobalSecondaryIndexes:
- IndexName: "bid-uid-index"
    KeySchema:
    - AttributeName: "bid"
    KeyType: "HASH"
    - AttributeName: "uid"
    KeyType: "RANGE"
    Projection: 
    ProjectionType: "ALL"
    ProvisionedThroughput:
    ReadCapacityUnits: 1
    WriteCapacityUnits: 1

Changin it to above fixed the errors...

like image 138
Prabhat Avatar answered Dec 06 '25 23:12

Prabhat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!