playwright: [BUG] Private Network Requests Hang When Route Is Registered

Context:

  • Playwright Version: 1.19.0
  • Operating System: Mac
  • Node.js version: 14.17
  • Browser: Chromium

Code Snippet

import {test} from @playwright/test';
test('hangs requests to private network', async ({page}) => {
  page.route('**', route => route.continue()); // <-- this causes the bug
});

Describe the bug Let’s say I have a website that fetches something from my local server. If I don’t stub any network calls in my test, then all works like expected. But if I have a Route defined in my test, then the request to my local (private) network hangs. Even if I have a route that doesn’t match any request throughout the test, it’ll still fail.

await page.route('/a-url-that-is-never-called', route => route.continue());

I’ve created a repository that shows exactly what the issue is about.
https://github.com/citizensas/chromium-private-network-playwright

This is very similar to the #5952 issue.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 24
  • Comments: 17 (4 by maintainers)

Most upvoted comments

@pavelfeldman @dgozman this will likely be a blocker for many corporations in using Playwright, is there anything I could debug on my side to help get to the bottom of this in Playwright? I am happy to, just need a point in the right direction inside Playwright on how/where to debug this issue as there is no feedback when using it that it is getting hung up

I have this issue too, quite weird behavior. My browser is Chromium. Wanting a workaround for this, anyone knows? 🙇‍♂️

I have a workaround that I use. Let’s say the issue happens when I try to send a request to some 127.0.0.1 on port 8080. I define this route to be intercepted and works for me. You can adjust to your specific URL if you want.

await page.route(
  (url) => url.host === '127.0.0.1:8080, 
  async (route, req) => route.fulfill({
    response: await page.request.fetch(req)
}));

Looks like this is fixed on the newer versions of Chromium. I installed the browser with the latest Playwright version and it works. If most of the affected users confirm that the issue is indeed fixed for them too, then we can close this issue.

Any updates on this issue? Just testing out Playwright and I believe hitting this as the symptoms/causes are the same and would completely block our usage of Playwright.

I did find this issue though and it is hard to tell which issue we are being hit by: https://github.com/microsoft/playwright/issues/10376

I’ve tried @citizensas 's solution, but unfortunately I’m using a self-signed cert so the node process throws Error: route.fetch: unable to verify the first certificate when using that method. I am still seeing this issue in playwright 1.33.0

I have this issue too, quite weird behavior. My browser is Chromium. Wanting a workaround for this, anyone knows? 🙇‍♂️

Unfortunately, I have this issue too with Chromium.

@citizensas This is all implemented in crNetworkManager.ts file. We assume one-to-one mapping between requestWillBeSent and requestPaused which is not the case here. The proper solution will most likely be upstream in Chromium though, so I wouldn’t try to patch it up in crNetworkManager right away.