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.

StreamingBody Issue in Record Mode

See original GitHub issue

Today I had the problem with the following code in record mode:

            stdout_key = self._s3.Object(bucket_name='somebucket',
                                         key='{}/stdout'.format(location))
            result_output = stdout_key.get()['Body'].read()

No matter what, result_output was always ''. After some digging, I was able to determine that the stream was already read.

(Pdb) test = stdout_key.get()['Body']
(Pdb) test._raw_stream.tell()
5

Important note: the tests run fine and work as expected when in playback mode, and the content of the StreamingBody is saved correctly to the cassette.

My assumption: Placebo is read()ing the StreamingBody while in record mode so that it can save it to the cassette.

Is there any way we can still present the results correctly? I’d like to avoid having my tests fail in record mode and then pass during playback mode. 😛

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
markfinkcommented, Oct 21, 2016

@fxfitz I ran into the same issue. your patch works for me. great job - thank you!

0reactions
fxfitzcommented, Oct 21, 2016

Awesome, @markfink! Thanks for the feedback! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boto3 S3 StreamingBody().read() reads once and returns ...
complete bytes removed for brevity. I get an object, and read it. Then I read it again, but no bytes are returned.
Read more >
Unable to read botocore.response.StreamingBody due to ...
The csv contains mostly numerical values and some categorical values for training a machine learning model. It has got 228945 lines of records...
Read more >
Streaming Data with Spring Boot - Medium
In this article, we are going to look at an example to download files using StreamingResponseBody. In this approach, data is processed and ......
Read more >
S3 — Boto3 Docs 1.26.36 documentation - Amazon AWS
BypassGovernanceRetention (boolean) -- Indicates whether S3 Object Lock should bypass Governance-mode restrictions to process this operation.
Read more >
Two Buckets and a Lambda: a pattern for file processing
In many cases it's a simple matter of moving the files back into ... is that they assume there will only be a...
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