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
Request interceptions cause web workers network requests to hang #4208
Comments
I'm closing because it's a dupe of #2781 |
Let me reopen this - looks like a bug to me. Should be addressed with the work we do to support #2548. |
It seems that this hack “fixes” it:
Not sure what a proper fix to that issue though. |
This works around a puppeteer issue when running scripts within a web worker. See puppeteer/puppeteer#4208.
This works around a puppeteer issue when running scripts within a web worker. See puppeteer/puppeteer#4208.
This works around a puppeteer issue when running scripts within a web worker. See puppeteer/puppeteer#4208.
I did it! When the desired effect is achieved, remove the intercept await page.setRequestInterception(true)
page.on('request', async function jsRequest(res) {
if (/modules\/cube-loader\/cube-loader\.min\.js(?=\?.*)/.test(res.url())) {
const jsCont = getExtendsJs('src/extendsJS/cube-loader.min.js');
await res.respond({
status: 200,
contentType: 'application/javascript; charset=utf-8',
body: jsCont
});
page.removeListener('request',jsRequest);
await page.setRequestInterception(false)
return false
}
res.continue();
}); |
I seem to have hit this issue as well, and the workaround in #4208 (comment) worked. Thanks @SilurianYang! |
I'm having the same issue, is there a plan to fix the issue? |
this approach does not seem to work in 2.0 though |
Having the same issue, |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
Still hitting this in 15.4.0 |
I'm hitting this as well. I worked around the issue by inlining my worker script as base64 data url using Parcel's bundle inlining. Also, my worker doesn't need to send any requests. It's not pretty or production friendly, but thankfully my page is only used for testing. |
I've run into this problem even when my web worker does not send network requests. Removing request interception resolves the problem, though it's not ideal. |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
This issue still persists. |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
Is there an upstream bug for this? The issue still exists in v19 |
@sidvishnoi I don't think there is an upstream bug. I am not quite sure it's an upstream bug at this point: perhaps the Network.requestWillBeSent is dispatched on the worker target while the Network.requestIntercepted events are dispatched on the page target. I'd be great if someone could dig into it: I will see if I find time. |
It appears that either something in Puppeteer fixed it or more likely upstream changes. I am not able to reproduce it with 22.6.3 |
When setting a request interception to a page, the page's workers can no longer make network request, because otherwise they will stop responding. both
importScripts
andfetch
.It is critical to mention that this behavior does work on native CDP
Steps to reproduce
I've created a repo with a script that does the following, and also shows that a "native" implementation using CDP alone does work:
worker.js
that makes a network call of some sortTell us about your environment:
What steps will reproduce the problem?
Please include code that reproduces the issue.
npm i
node puppeteer.js
What is the expected result?
What happens instead?
The text was updated successfully, but these errors were encountered: