Common Serverless Framework Cloudformation Template Errors

Tags: dynamodb appsync serverless

A list of solutions to common Serverless Framework errors with AWS.

Template error: instance of Fn::GetAtt references undefined resource GraphQlDsTaskTable

This can happen when using serverless-appsync-plugin. The error is thrown when a dataSource is missing:

custom:
  appSync:
    name: example.com
    <snip>
    dataSources:
      - type: AMAZON_DYNAMODB
        name: TaskTable
        description: "TaskTable table"
        config:
          tableName: "TaskTable"
1
2
3
4
5
6
7
8
9
10

An error occurred: TaskTable - Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes.

When defining a global secondary index in DynamoDB, you need to make sure that attribute is also listed under attribute definitions:










 
 















BookTable:
  Type: "AWS::DynamoDB::Table"
  Properties:
    KeySchema:
      - AttributeName: id
        KeyType: HASH
    AttributeDefinitions:
      - AttributeName: id
        AttributeType: S
      - AttributeName: username
        AttributeType: S
    ProvisionedThroughput:
      ReadCapacityUnits: 1
      WriteCapacityUnits: 1
    TableName: "TaskTable"
    GlobalSecondaryIndexes:
      - IndexName: username-index
        KeySchema:
          - AttributeName: username
            KeyType: HASH
        Projection:
          ProjectionType: ALL
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

Copyright © 2018 Daniel and Audrey Roy Greenfeld.
Site Map

Last Updated: 9/2/2018, 8:23:55 PM