Amplify-cli: TransactWriteItems resolver, how to assign DynamoDb table name

Created on 1 Apr 2020  路  6Comments  路  Source: aws-amplify/amplify-cli

AppSync resolvers support TransactWriteItems operation and in transactItems I have to define DynamoDb table for each item, but Amplify adds some suffix to table names. Is there some way to retrieve this suffix in resolver?

Which Category is your question related to?
Amplify, AppSync, DynamoDb resolver, TransactWriteItems.

Amplify CLI Version
4.17.2

graphql-transformer pending-response question

Most helpful comment

@regenrek

Check if you use old mapping template version. Currently there are two versions 2018-05-29 and 2017-02-28. Try to use new one.
You can read here

Somehow I had this issue with new version, write if you find out how to reproduce this.

All 6 comments

Seems like Amplify is not yet supported TransactWriteItems. I got this error:

{
  "data": {
    "createMessage": null
  },
  "errors": [
    {
      "path": [
        "createMessage"
      ],
      "data": null,
      "errorType": "MappingTemplate",
      "errorInfo": null,
      "locations": [
        {
          "line": 2,
          "column": 3,
          "sourceName": null
        }
      ],
      "message": "Unsupported operation 'TransactWriteItems'."
    }
  ]
}

I will be appreciated for any answer.

@lenarmazitov you don't need to access the table name as it is defined as part of your DataSource definition, the resolver's output JSON will be directed to the configured DynamoDB table automatically.

In the AppSync documentation there is a full example for TransactWriteItems.

If this does not answer your question, please elaborate on your use case which requires the table name in the resolver.

@attilah
but table is mandatory field like described here

Hi @lenarmazitov did you find a solution for the error:

"Unsupported operation 'TransactWriteItems'."

@regenrek

Check if you use old mapping template version. Currently there are two versions 2018-05-29 and 2017-02-28. Try to use new one.
You can read here

Somehow I had this issue with new version, write if you find out how to reproduce this.

Was this page helpful?
0 / 5 - 0 ratings