Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp parsing issue since 3.144.0 #2053

Closed
3 tasks done
jaikdean opened this issue Jul 2, 2020 · 2 comments · Fixed by #2054
Closed
3 tasks done

Timestamp parsing issue since 3.144.0 #2053

jaikdean opened this issue Jul 2, 2020 · 2 comments · Fixed by #2054
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@jaikdean
Copy link

jaikdean commented Jul 2, 2020

Describe the bug
Creating a DynamoDB table results in an exception being thrown from the internal timestamp parsing code.

Version of AWS SDK for PHP?
3.144.0 to 3.144.2 (latest)

Version of PHP (php -v)?
7.4.7

To Reproduce (observed behavior)

Using DynamoDB Local…

<?php

$client = new DynamoDbClient([
    'credentials' => new Credentials('TheseCredentials', 'DontMatter'),
    'endpoint' => 'http://localhost:8000',
    'region' => 'eu-west-1',
    'version' => '2012-08-10',
]);

$client->createTable([
    'AttributeDefinitions' => [
        [
            'AttributeName' => 'subject_id',
            'AttributeType' => 'S',
        ],
        [
            'AttributeName' => 'timestamp',
            'AttributeType' => 'N',
        ],
    ],
    'BillingMode' => 'PAY_PER_REQUEST',
    'KeySchema' => [
        [
            'AttributeName' => 'subject_id',
            'KeyType' => 'HASH',
        ],
        [
            'AttributeName' => 'timestamp',
            'KeyType' => 'RANGE',
        ],
    ],
    'TableName' => 'events',
]);

This results in the following exception:

Aws\Api\Parser\Exception\ParserException: Invalid timestamp value passed to DateTimeResult::fromTimestamp

/path/to/vendor/aws/aws-sdk-php/src/Api/DateTimeResult.php:53
/path/to/vendor/aws/aws-sdk-php/src/Api/Parser/JsonParser.php:48
/path/to/vendor/aws/aws-sdk-php/src/Api/Parser/JsonParser.php:24
/path/to/vendor/aws/aws-sdk-php/src/Api/Parser/JsonParser.php:24
/path/to/vendor/aws/aws-sdk-php/src/Api/Parser/JsonParser.php:24
/path/to/vendor/aws/aws-sdk-php/src/Api/Parser/JsonRpcParser.php:49
/path/to/vendor/aws/aws-sdk-php/src/Api/Parser/JsonRpcParser.php:36
/path/to/vendor/aws/aws-sdk-php/src/Api/Parser/Crc32ValidatingParser.php:44
/path/to/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:125
/path/to/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:92
/path/to/vendor/guzzlehttp/promises/src/Promise.php:203
/path/to/vendor/guzzlehttp/promises/src/Promise.php:156
/path/to/vendor/guzzlehttp/promises/src/TaskQueue.php:47
/path/to/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php:155
/path/to/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php:182
/path/to/vendor/guzzlehttp/promises/src/Promise.php:246
/path/to/vendor/guzzlehttp/promises/src/Promise.php:223
/path/to/vendor/guzzlehttp/promises/src/Promise.php:267
/path/to/vendor/guzzlehttp/promises/src/Promise.php:225
/path/to/vendor/guzzlehttp/promises/src/Promise.php:267
/path/to/vendor/guzzlehttp/promises/src/Promise.php:225
/path/to/vendor/guzzlehttp/promises/src/Promise.php:62
/path/to/vendor/aws/aws-sdk-php/src/AwsClientTrait.php:58
/path/to/vendor/aws/aws-sdk-php/src/AwsClientTrait.php:86
/path/to/testcase.php:

Expected behavior
The table is created.

Screenshots
N/A

Additional context
N/A

@jaikdean jaikdean added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 2, 2020
@SamRemis
Copy link
Member

SamRemis commented Jul 2, 2020

Thank you so much for pointing this out @jaikdean

We just pushed a fix for this issue with today's release and it should be working now.

@codebymike
Copy link

If anyone else finds this - you're missing "date_default_timezone_set($timezone);"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants