question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kinesis stubber for put_records_batch() does not accept FailedRecordCount == 0

See original GitHub issue

Describe the bug When stubbing like this:

kinesis_stubber.add_response(
            'put_records',
            expected_params={
                'Records': ANY,
                'StreamName': ANY
            },
            service_response={
                'FailedRecordCount': 0,
                'Records': response_batch
            }
        )

An error is throw that says FailedRecordCount can not be 0.

      raise ParamValidationError(report=report.generate_report())

E botocore.exceptions.ParamValidationError: Parameter validation failed: E Invalid range for parameter FailedRecordCount, value: 0, valid range: 1-inf

I have verified the actual api call for kinesis client put_records() does always return a value for FailedRecordCount and it can indeed be 0.

Steps to reproduce stub a kinesis client call as outlined above.

Expected behavior The service_response of the stubbed should accept a value of “0” for FailedRecordCount

Debug logs Full stack trace by adding

'FailedRecordCount' is always returned and it was 0, but stubber says no:
params = {'FailedRecordCount': 0, 'Records': [{'SequenceNumber': 'string', 'ShardId': 'string'}, {'SequenceNumber': 'string', '... 'string'}, {'SequenceNumber': 'string', 'ShardId': 'string'}, {'SequenceNumber': 'string', 'ShardId': 'string'}, ...]}
shape = <StructureShape(PutRecordsOutput)>

    def validate_parameters(params, shape):
        """Validates input parameters against a schema.
    
        This is a convenience function that validates parameters against a schema.
        You can also instantiate and use the ParamValidator class directly if you
        want more control.
    
        If there are any validation errors then a ParamValidationError
        will be raised.  If there are no validation errors than no exception
        is raised and a value of None is returned.
    
        :param params: The user provided input parameters.
    
        :type shape: botocore.model.Shape
        :param shape: The schema which the input parameters should
            adhere to.
    
        :raise: ParamValidationError
    
        """
        validator = ParamValidator()
        report = validator.validate(params, shape)
        if report.has_errors():
>           raise ParamValidationError(report=report.generate_report())
E           botocore.exceptions.ParamValidationError: Parameter validation failed:
E           Invalid range for parameter FailedRecordCount, value: 0, valid range: 1-inf

Please let me know if I need to add anymore detail. This is breaking all of our test cases!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
seapencommented, Mar 8, 2021

Was this issue ever resolved? I seem to be having the same issue.

0reactions
nojohnny101commented, Jun 4, 2020

Any movement on this? This is blocking all of our team’s tests as our code can’t complete when stubbing the response!

Read more comments on GitHub >

github_iconTop Results From Across the Web

PutRecords - Amazon Kinesis Data Streams Service
Kinesis Data Streams attempts to process all records in each PutRecords request. A single record failure does not stop the processing of subsequent...
Read more >
Loading multiple records to Kinesis using PutRecords - how to ...
A record that is successfully added to a stream includes SequenceNumber and ShardId in the result. A record that fails to be added...
Read more >
aws kinesis records missing · Issue #1003 - GitHub
I encounter an issue that records lost when called PutRecords api to send data to kinesis. It returns no error when call PutRecords...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found