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

DynamoDB: #next_page on PagableResponse does not work when using a key condition in v2.1.0 #843

Closed
hoffi opened this issue Jun 16, 2015 · 1 comment

Comments

@hoffi
Copy link

hoffi commented Jun 16, 2015

In Version 2.1.0 #each, #each_page or #next_page does not work when i have a KeyConditionExpression + ExpressionAttributeValues in my Query.

Example:

require 'aws-sdk'
client = Aws::DynamoDB::Client.new(region: 'eu-west-1')

result = client.query(table_name: 'users', index_name: 'username_index', 
             key_condition_expression: 'user_name = :name',
             expression_attribute_values: { ':name' => 'test' })

result.each { |page| puts page }

Produces following exception:

Aws::DynamoDB::Errors::ValidationException: One or more parameter values were invalid: Condition parameter type does not match schema type
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:112:in `call'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/aws-sdk-core/plugins/param_converter.rb:21:in `call'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/aws-sdk-core/plugins/response_paging.rb:25:in `call'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/seahorse/client/plugins/response_target.rb:18:in `call'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/seahorse/client/request.rb:70:in `send_request'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/aws-sdk-core/pageable_response.rb:109:in `next_response'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/aws-sdk-core/pageable_response.rb:64:in `next_page'
        from /usr/local/lib/ruby/gems/2.2.0/gems/aws-sdk-core-2.1.0/lib/aws-sdk-core/pageable_response.rb:76:in `each'

Looks like the ExpressionAttributeValues are missing.
When i manually call #next_page with the parameter it does work:

result.next_page # Does not work
result.next_page(expression_attribute_values: { ':name' => 'test' }) # Works

This problem does not occur in Version 2.0.48

@trevorrowe
Copy link
Member

Thanks for reporting the issue. I've fixed this regression and added a test case. The fix should be released shortly.

@srchase srchase added the bug label Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants