RikudouSage / DynamoDbCachePsr6

PSR-6 and PSR-16 cache implementation using AWS DynamoDB
MIT License
6 stars 4 forks source link

Version 2.0.0 doesn't work #14

Closed shadowhand closed 3 years ago

shadowhand commented 3 years ago

I can't figure out why, but upgrading to version 2.0.0 causes all calls to error with:

Code:    ResourceNotFoundException
Message: Cannot do operations on a non-existent table

Nothing about my configuration has changed, other than switching:

- use Aws\DynamoDb\DynamoDbClient;
+ use AsyncAws\DynamoDb\DynamoDbClient;
RikudouSage commented 3 years ago

Do you have any more details? Do you have correct region? Does the table exist in the region?

shadowhand commented 3 years ago

As I said, the only change was switching versions and replacing the client. Region is correct, table is correct and exists. There's really nothing else to report; it was working, I upgraded, and now it doesn't.

RikudouSage commented 3 years ago

Well, AWS is a little magic when it comes to guessing your configuration, it's possible the official SDK got the region from somewhere else.

Can you send a snippet of how you construct the object?

shadowhand commented 3 years ago
final class DynamoDbCacheFactory
{
    public function __invoke(ContainerInterface $container): DynamoDbCache
    {
        return new DynamoDbCache(
            tableName: $container->get('aws.dynamodb.tables.cache'),
            client: $container->get(DynamoDbClient::class),
            prefix: $container->get('app.version'),
        );
    }
}
RikudouSage commented 3 years ago

And the DynamoDbClient?

shadowhand commented 3 years ago

I think I found the problem. It seems that AsyncAws doesn't respect region being configured and defaults to us-east-1 for all operations. Or at least it does when configured with a custom endpoint.

https://github.com/async-aws/aws/issues/1111