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

[BUG] Request postData() always returns null #9648

Closed
karamfilovs opened this issue Oct 20, 2021 · 12 comments
Closed

[BUG] Request postData() always returns null #9648

karamfilovs opened this issue Oct 20, 2021 · 12 comments
Assignees

Comments

@karamfilovs
Copy link

karamfilovs commented Oct 20, 2021

Context:

  • Playwright Version: 1.15.2 (Java binding)
  • Operating System: Linux, Windows, MacOs
  • Browser: Chrome, Edge
  • The issue is reproducible for js version of the library as well.

Code Snippet

Listening for request with specific url pattern stopped returning postData.

Log:
2021:10:20:14:31:11.742  INFO  MoviePage - Request url: */beat
2021:10:20:14:31:11.745  INFO  MoviePage - Headers:{sec-ch-ua="Chromium";v="94", "Microsoft Edge";v="94", ";Not A Brand";v="99", referer=https://*/, sec-ch-ua-mobile=?0, user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36 Edg/94.0.992.50, sec-ch-ua-platform="Windows", content-type=application/json}
2021:10:20:14:31:11.747  INFO  MoviePage - Data:null
2021:10:20:14:31:11.748  INFO  MoviePage - Method:POST

Describe the bug
Launch browser
Listen for request by specific url pattern
Print request details url, postData, headers

The above test used to work for few months without any issues. I was able to retrive postData and analyze it

The request postData is visible in the browser network tab so its definately not null. It looks like a problem in the communication between browser and playwright library.
beat
.

@pavelfeldman
Copy link
Member

Could you help us reproducing this?

@karamfilovs
Copy link
Author

@pavelfeldman sure.

@karamfilovs
Copy link
Author

The easiest way is to:

  1. Open https://www.joyn.de/play/trailer/filme/john-wick/john-wick
  2. Accept the cookies
  3. Start the movie
  4. Listen for **/beat requests
  5. Check body

@pavelfeldman
Copy link
Member

it does not want to play ("Hoppla! Da ist etwas schief gelaufen."). But I'm seeing that every other /beat request is a cors preflight:

Screen Shot 2021-10-22 at 4 32 02 PM

Does this looks like what you are seeing?

@karamfilovs
Copy link
Author

karamfilovs commented Oct 24, 2021

I forgot to tell you that we have geo location blocking for countries outside EU. This is the reason why video does not start(message is not very helpful in this case). I dont know if you can connect to vpn somewhere in EU. I will double check again about the preflight.

@karamfilovs
Copy link
Author

beats

@dgozman
Copy link
Contributor

dgozman commented Oct 28, 2021

I can repro this with the following script in Chromium. Works as expected in WebKit, does not load in Firefox.

const playwright = require('playwright');

(async () => {
  const browser = await playwright.chromium.launch({ headless: false, channel: 'chrome' });

  const page = await browser.newPage();
  page.on('request', r => {
    if (r.url().endsWith('/beat')) {
      console.log(r.url(), r.postData(), r.headers());
    }
  });
  await page.goto('https://www.joyn.de/play/trailer/filme/john-wick/john-wick');
})();

Network.requestWillBeSent comes with hasPostData: true but no post data. I suspect that post data is a blob, so Chromium bails out here. Perhaps Network.getRequestPostData could help.

In this particular case, Request is created with some json data, but later on fetch(request.clone()) is called, and cloning a request forces both of them to have a blob body.

@dgozman dgozman self-assigned this Oct 28, 2021
@dgozman dgozman added v1.17 and removed triaging labels Oct 28, 2021
@karamfilovs
Copy link
Author

@dgozman I am glad that you have managed to reproduce it.
You are right about Firefox nightly, the video does not start because some plugins are missing.

@mxschmitt
Copy link
Member

Merging into #6479

@karamfilovs
Copy link
Author

karamfilovs commented Nov 22, 2021

Just bumped to 1.17 and the issue is still reproducible. Is the fix included in v1.17?

2021:11:22:10:20:27.688 INFO e2e.pages.MoviePage - Request url:https:/*/beat 2021:11:22:10:20:27.689 INFO e2e.pages.MoviePage - Headers:{sec-ch-ua=" Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96", referer=https://*, sec-ch-ua-mobile=?0, user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36, sec-ch-ua-platform="Windows", content-type=application/json} 2021:11:22:10:20:27.690 INFO e2e.pages.MoviePage - Data:null 2021:11:22:10:20:27.690 INFO e2e.pages.MoviePage - Method:POST 2021:11:22:10:20:27.691 INFO e2e.pages.MoviePage - Buffer:null

@mxschmitt
Copy link
Member

It is not fixed yet, the issue was just merged into #6479.

@karamfilovs
Copy link
Author

karamfilovs commented Nov 22, 2021

Thanks I was probably misleaded by the tag v1.17 above.

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

4 participants