Repository: localstack/localstack

Issue:
bug: DynamoDB TransactGetItems always returns ResourceNotFoundException
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

* Create any table with any records
* Do a TransactGetItems on the table
* Localstack returns 
```
ResourceNotFoundException: Cannot do operations on a non-existent table
```

### Expected Behavior

TransactGetItems should succeed.

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

```
docker-compose up
```

`docker-compose.yml`
```
version: '3'

services:
  localstack:
    image: localstack/localstack
    environment:
      - DEFAULT_REGION=eu-west-2
      - SERVICES=dynamodb
      - DOCKER_HOST=unix:///var/run/docker.sock
    ports:
      - 4566:4566
```

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

```
#! /bin/bash
aws --endpoint-url=http://localhost:4566 dynamodb create-table --attribute-definitions AttributeName=forumId,AttributeType=S --table-name forum --key-schema AttributeName=forumId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 > /dev/null
aws --endpoint-url=http://localhost:4566 dynamodb put-item --table-name forum --item '{"forumId": {"S": "forum001"}, "data": {"S": "helloworld"}}' > /dev/null
aws --endpoint-url=http://localhost:4566 dynamodb get-item --table-name forum --key '{"forumId": {"S": "forum001"}}' > /dev/null
# This one fails
aws --endpoint-url=http://localhost:4566 dynamodb transact-get-items --transact-items '[{"Get": {"Key":{"forumId": {"S": "forum001"}}, "TableName": "forum"}}]' > /dev/null
```


### Environment

```markdown
- OS: MacOS 10.15.7
- LocalStack: latest, digest 843db39ff1df83fd537e15b30e39d6fb8c3590efd6bf3f6f96b1734418fbd19f
```


### Anything else?

This works in `localstack/localstack:0.14.1`


Discussion:
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our [Slack Community](https://localstack.cloud/contact/) for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our [contributing guidelines](https://github.com/localstack/.github/blob/main/CONTRIBUTING.md) and our [developer guide](https://docs.localstack.cloud/developer-guide/).

Resolving patch:
diff --git a/localstack/services/dynamodb/provider.py b/localstack/services/dynamodb/provider.py
--- a/localstack/services/dynamodb/provider.py
+++ b/localstack/services/dynamodb/provider.py
@@ -67,6 +67,8 @@
     TagKeyList,
     TagList,
     TimeToLiveSpecification,
+    TransactGetItemList,
+    TransactGetItemsOutput,
     TransactWriteItemsInput,
     TransactWriteItemsOutput,
     UpdateGlobalTableOutput,
@@ -767,6 +769,15 @@ def transact_write_items(
 
         return result
 
+    @handler("TransactGetItems", expand=False)
+    def transact_get_items(
+        self,
+        context: RequestContext,
+        transact_items: TransactGetItemList,
+        return_consumed_capacity: ReturnConsumedCapacity = None,
+    ) -> TransactGetItemsOutput:
+        return self.forward_request(context)
+
     @handler("ExecuteStatement", expand=False)
     def execute_statement(
         self,
@@ -1286,7 +1297,7 @@ def has_event_sources_or_streams_enabled(table_name: str, cache: Dict = None):
 
     # if kinesis streaming destination is enabled
     # get table name from table_arn
-    # since batch_wrtie and transact write operations passing table_arn instead of table_name
+    # since batch_write and transact write operations passing table_arn instead of table_name
     table_name = table_arn.split("/", 1)[-1]
     table_definitions = DynamoDBRegion.get().table_definitions
     if not result and table_definitions.get(table_name):


Test patch:
diff --git a/tests/integration/test_dynamodb.py b/tests/integration/test_dynamodb.py
--- a/tests/integration/test_dynamodb.py
+++ b/tests/integration/test_dynamodb.py
@@ -807,6 +807,21 @@ def test_transaction_write_items(self):
         # clean up
         dynamodb.delete_table(TableName=table_name)
 
+    def test_transact_get_items(self, dynamodb_client):
+        table_name = "test-ddb-table-%s" % short_uid()
+        dynamodb_client.create_table(
+            TableName=table_name,
+            KeySchema=[{"AttributeName": "id", "KeyType": "HASH"}],
+            AttributeDefinitions=[{"AttributeName": "id", "AttributeType": "S"}],
+            ProvisionedThroughput={"ReadCapacityUnits": 5, "WriteCapacityUnits": 5},
+        )
+        dynamodb_client.put_item(TableName=table_name, Item={"id": {"S": "John"}})
+        result = dynamodb_client.transact_get_items(
+            TransactItems=[{"Get": {"Key": {"id": {"S": "John"}}, "TableName": table_name}}]
+        )
+        assert result["ResponseMetadata"]["HTTPStatusCode"] == 200
+        dynamodb_client.delete_table(TableName=table_name)
+
     def test_batch_write_items(self):
         table_name = "test-ddb-table-%s" % short_uid()
         dynamodb = aws_stack.create_external_boto_client("dynamodb")