ATD
ATD

Reputation: 51

Dynamodb aws Invalid Argument Exception

I have been stuck on this for a few days now and any help would be great.

I am trying to data from CSV files into Dynamodb with the SDK for PHP. I am reading from a CSV file and writing the records into the database using batchwriteto insert the records. I am inserting everything as a string. It inserts about 4000 records and then gives me the following error:

PHP Fatal error:  Uncaught exception 
'Guzzle\Common\Exception\InvalidArgumentException' with message 'Invalid 
resource type' in /home/ubuntu/aws-php-
sample/vendor/guzzle/guzzle/src/Guzzle/Http/EntityBody.php:50

What does this error mean, and why am I getting this?

Is it because those set of records I am attempting to insert have some characters that are not accepted by dynamo?

Upvotes: 0

Views: 533

Answers (2)

Quibski
Quibski

Reputation: 11

Got similar problem. Ive noticed that dynamo didnt play well with non-utf-8 characaters. So I had to utf-8 encode them before storing them to the sessions.

Make sure you check what you are storing if this error sometimes happens

Upvotes: 0

Jeremy Lindblom
Jeremy Lindblom

Reputation: 6527

The error you are getting is when Guzzle, the underlying HTTP library of the SDK, tries to create a request body. At some point in your process, the request body data being fed into Guzzle is invalid (NULL, possibly), but it's hard to determine why without additional information.

If you can figure out at what point it is failing or with what data, then you should open an issue on the AWS SDK for PHP with that information and the code you are using. Make sure you also check out DynamoDB's Limits page in their docs, which explains restrictions on data.

Upvotes: 1

Related Questions