axe-core-npm
axe-core-npm copied to clipboard
ProtocolError: Protocol error (Target.closeTarget): Target closed.
Product: puppeteer
Expectation: Run without giving this error in CI. - ProtocolError: Protocol error (Target.closeTarget): Target closed.
Actual: Gives this error.
Stack trace:
ProtocolError: Protocol error (Target.closeTarget): Target closed.
at executor (node_modules/puppeteer/src/common/Connection.ts:106:16)
at new ZoneAwarePromise (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:1347:33)
at Connection.send (node_modules/puppeteer/src/common/Connection.ts:102:12)
at Page.close (node_modules/puppeteer/src/common/Page.ts:2930:38)
at apply (node_modules/@axe-core/puppeteer/src/axePuppeteer.ts:284:19)
at ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:407:30)
at ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3765:43)
at ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:406:56)
at Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:167:47)
at apply (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:1325:38)
at ZoneDelegate.invokeTask (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:441:35)
at ProxyZoneSpec.onInvokeTask (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3796:43)
at ZoneDelegate.invokeTask (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:440:64)
at Zone.runTask (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:212:51)
at drainMicroTaskQueue (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:627:39)
at runMicrotasks (<anonymous>)
This: at apply (node_modules/@axe-core/puppeteer/src/axePuppeteer.ts:284:19)
is: blankPage.close();
Should this line be await
ed? (According to this issue)
Motivation: I'm using the package jest-puppeteer-axe (via storyshots-puppeteer) and this is causing it not to work in CI.
axe-core version: 4.4.1
@axe-core/puppeteer: 4.4.2
- Node version: 16.13.2
- Platform: Windows
I'm seeing this as well at the end of the test suite run. (Also using storyshots-puppeteer here. )
Shorter but similar stack trace:
● Test suite failed to run
ProtocolError: Protocol error (Target.closeTarget): Target closed.
at ../../node_modules/puppeteer/src/common/Connection.ts:106:16
at Connection.send (../../node_modules/puppeteer/src/common/Connection.ts:102:12)
at Page.close (../../node_modules/puppeteer/src/common/Page.ts:2930:38)
at ../../node_modules/@axe-core/puppeteer/src/axePuppeteer.ts:284:19
at runMicrotasks (<anonymous>)
I'm seeing this both on GitHub Actions and locally on Ubuntu.
Versions:
axe-core: 4.4.1
@axe-core/puppeteer: 4.4.2
Node.js: v16.14.2
Replacing:
https://github.com/dequelabs/axe-core-npm/blob/af77177b8431ba74c81e0dc22fe7c320e6b98565/packages/puppeteer/src/axePuppeteer.ts#L277-L285
with:
try {
return await blankPage
.evaluate(
axeFinishRun,
partialResults as JSONArray,
axeOptions as JSONObject
)
} finally {
await blankPage.close();
}
does indeed seem to resolve the problem from some local testing.
Looks like the playwright library could benefit from a similar change too:
https://github.com/dequelabs/axe-core-npm/blob/af77177b8431ba74c81e0dc22fe7c320e6b98565/packages/playwright/src/index.ts#L294
Closing this has been resolved in @axe-core/[email protected]
and @axe-core/[email protected]
.