Repository: localstack/localstack

Issue:
DynamoDB streams describe-streams returns ResourceNotFoundException
<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...

[x] bug report
[ ] feature request

# Detailed description

DynamoDB streams can be listed using `aws dynamodbstreams list-streams`, but doing `aws dynamodbstreams describe-stream` on a specific stream returns:
```
An error occurred (ResourceNotFoundException) when calling the DescribeStream operation: Requested resource not found: Stream: arn:aws:dynamodb:ca-central-1:000000000000:table/myspecialtable/stream/2020-06-10T18:51:23.742 not found
```
**_The issue is not present in 0.11.1 - it happens on 0.11.2_**

## Expected behavior

When invoking `aws dynamodbstreams describe-streams --stream-arn ${MY_STREAM_ARN}` should return a response similar to:

```
{
    "StreamDescription": {
        "StreamArn": "arn:aws:dynamodb:ca-central-1:000000000000:table/stream/2020-06-10T18:51:23.742",
        "StreamLabel": "2020-06-10T18:51:23.742",
        "StreamStatus": "ENABLED",
        "StreamViewType": "NEW_AND_OLD_IMAGES",
        ...
    }
}
```

## Actual behavior

Invoking `aws dynamodbstreams describe-streams --stream-arn ${MY_STREAM_ARN}` returns:

```
An error occurred (ResourceNotFoundException) when calling the DescribeStream operation: Requested resource not found: Stream: arn:aws:dynamodb:ca-central-1:000000000000:table/myspecialtable/stream/2020-06-10T18:51:23.742 not found
```

Even if the `aws dynamodbstreams list-streams` display the stream.

# Steps to reproduce

## Command used to start LocalStack

Using docker:

```
docker run --rm -e 'DEBUG=1' -e 'SERVICES=dynamodb,dynamodbstreams' -p 4566:4566 --name localstack localstack/localstack-light:0.11.2
```

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)

1. Create a DynamoDB table with streams enabled:
```
aws --endpoint-url http://localhost:4566 dynamodb create-table --attribute-definitions AttributeName=MyAttribute,AttributeType=S --key-schema AttributeName=MyAttribute,KeyType=HASH --table-name MyTable --stream-specification StreamEnabled=true,StreamViewType=NEW_IMAGE --billing-mode PAY_PER_REQUEST
{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "MyAttribute",
                "AttributeType": "S"
            }
        ],
        "TableName": "MyTable",
        "KeySchema": [
            {
                "AttributeName": "MyAttribute",
                "KeyType": "HASH"
            }
        ],
        "TableStatus": "ACTIVE",
        "CreationDateTime": 1591825040.59,
        "ProvisionedThroughput": {
            "LastIncreaseDateTime": 0.0,
            "LastDecreaseDateTime": 0.0,
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 0,
            "WriteCapacityUnits": 0
        },
        "TableSizeBytes": 0,
        "ItemCount": 0,
        "TableArn": "arn:aws:dynamodb:us-east-1:000000000000:table/MyTable",
        "BillingModeSummary": {
            "BillingMode": "PAY_PER_REQUEST",
            "LastUpdateToPayPerRequestDateTime": -1607826.226
        },
        "StreamSpecification": {
            "StreamEnabled": true,
            "StreamViewType": "NEW_IMAGE"
        },
        "LatestStreamLabel": "2020-06-10T21:37:20.590",
        "LatestStreamArn": "arn:aws:dynamodb:us-east-1:000000000000:table/MyTable/stream/2020-06-10T21:37:20.590"
    }
}

```

2. List streams:
```
aws --endpoint-url http://localhost:4566 dynamodbstreams list-streams
{
    "Streams": [
        {
            "StreamArn": "arn:aws:dynamodb:us-east-1:000000000000:table/MyTable/stream/2020-06-10T21:37:20.590",
            "TableName": "MyTable",
            "StreamLabel": "2020-06-10T21:37:20.590"
        }
    ]
}

```

3. Describe a stream:
```
aws --endpoint-url http://localhost:4566 dynamodbstreams describe-stream --stream-arn arn:aws:dynamodb:us-east-1:000000000000:table/MyTable/stream/2020-06-10T21:37:20.590

An error occurred (ResourceNotFoundException) when calling the DescribeStream operation: Requested resource not found: Stream: arn:aws:dynamodb:us-east-1:000000000000:table/MyTable/stream/2020-06-10T21:37:20.590 not found
```



Discussion:

Resolving patch:
diff --git a/localstack/services/edge.py b/localstack/services/edge.py
--- a/localstack/services/edge.py
+++ b/localstack/services/edge.py
@@ -105,7 +105,8 @@ def get_api_from_headers(headers, path=None):
     elif '.execute-api.' in host:
         result = 'apigateway', config.PORT_APIGATEWAY
     elif target.startswith('DynamoDBStreams') or host.startswith('streams.dynamodb.'):
-        result = 'dynamodbstreams', config.PORT_DYNAMODBSTREAMS
+        # Note: DDB streams requests use ../dynamodb/.. auth header, hence we also need to update result_before
+        result = result_before = 'dynamodbstreams', config.PORT_DYNAMODBSTREAMS
     elif ls_target == 'web' or path == '/graph':
         result = 'web', config.PORT_WEB_UI
 


Test patch: