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]: ESM module exports in Puppeteer 13.3.0 break devtools integration (ERR_PACKAGE_PATH_NOT_EXPORTED) #7994

Closed
3 tasks done
jan-molak opened this issue Feb 10, 2022 · 8 comments
Labels

Comments

@jan-molak
Copy link
Contributor

jan-molak commented Feb 10, 2022

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

7.16.14

Node.js Version

16.13.1

Mode

WDIO Testrunner

Which capabilities are you using?

headless: true,
    automationProtocol: 'devtools',

    runner: 'local',

    capabilities: [{

        browserName: 'chrome',
        'goog:chromeOptions': {
            args: [
                '--headless',
                '--disable-infobars',
                '--no-sandbox',
                '--disable-gpu',
                '--window-size=1024x768',
            ],
        },
    }],

What happened?

@serenity-js/webdriverio: [0-8] 2022-02-09T19:46:25.742Z ERROR @wdio/runner: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/cjs/puppeteer/common/USKeyboardLayout' is not defined by "exports" in /home/runner/work/serenity-js/serenity-js/packages/webdriverio/node_modules/webdriverio/node_modules/puppeteer-core/package.json
@serenity-js/webdriverio: [0-8]     at new NodeError (internal/errors.js:322:7)
@serenity-js/webdriverio: [0-8]     at throwExportsNotFound (internal/modules/esm/resolve.js:332:9)
@serenity-js/webdriverio: [0-8]     at packageExportsResolve (internal/modules/esm/resolve.js:565:3)
@serenity-js/webdriverio: [0-8]     at resolveExports (internal/modules/cjs/loader.js:450:36)
@serenity-js/webdriverio: [0-8]     at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
@serenity-js/webdriverio: [0-8]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
@serenity-js/webdriverio: [0-8]     at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/runner/work/serenity-js/serenity-js/node_modules/@cspotcode/source-map-support/source-map-support.js:679:30)
@serenity-js/webdriverio: [0-8]     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
@serenity-js/webdriverio: [0-8]     at Module.require (internal/modules/cjs/loader.js:974:19)
@serenity-js/webdriverio: [0-8]     at require (internal/modules/cjs/helpers.js:101:18)

@christian-bromann?

What is your expected behavior?

I'd expect WebdriverIO to work with Puppeteer and not throw errors

How to reproduce the bug.

  • Run any test in WebdriverIO using the devtools protocol, local Chrome (I'm using v98) and puppeteer-core 13.3.0
  • see ERR_PACKAGE_PATH_NOT_EXPORTED

Relevant log output

See above.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues
@jan-molak jan-molak added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels Feb 10, 2022
@christian-bromann
Copy link
Member

This problem is caused based on one of the imports you find in performActions.ts. I had to import it this way because there was no other way to do so and of course at some points it would break. The solution to this would be to find a better way to import this file. Maybe they properly export it now.

@jan-molak you want to take a stab at it?

@christian-bromann christian-bromann removed the Needs Triaging ⏳ No one has looked into the issue yet label Feb 10, 2022
@jan-molak
Copy link
Contributor Author

I might give it a shot tonight ;-)

@abianche
Copy link

abianche commented Feb 10, 2022

Is there any way to workaround the issue until this gets fixed?
Thanks.

EDIT: downgrading wdio deps. obviously worked.

@christian-bromann
Copy link
Member

@abianche you can also help provide a fix 😉

@jan-molak
Copy link
Contributor Author

@abianche looks like it might get fixed at the source - puppeteer/puppeteer#7986

@jan-molak
Copy link
Contributor Author

jan-molak commented Feb 10, 2022

OK, Puppeteer has reverted the change in 13.3.1 (puppeteer/puppeteer@179eded).
Closing.

Thanks for replying, @christian-bromann - good to know you're still around ;-)

@christian-bromann
Copy link
Member

Awesome!

@pdrmailbox
Copy link

Is there any way to workaround the issue until this gets fixed? Thanks.

EDIT: downgrading wdio deps. obviously worked.

Workaround

If you have backup of "node_modules/puppeteer-core" then overwrite it. It worked for us.

Also you may try using previous version of "puppeteer-core" package from https://www.npmjs.com/package/puppeteer-core.

straker added a commit to dequelabs/axe-core-npm that referenced this issue May 16, 2022
We believe the issue that caused us to pin to 7.14.1 was this one webdriverio/webdriverio#7994. Testing versions of webdriverio 7.14 - 7.19 no longer causes us any issues. The issue seems to have been resolved and we no longer need to pin to a specific version.
straker added a commit to dequelabs/axe-core-npm that referenced this issue May 17, 2022
* chore: update webdriverio peerDependency

We believe the issue that caused us to pin to 7.14.1 was this one webdriverio/webdriverio#7994. Testing versions of webdriverio 7.14 - 7.19 no longer causes us any issues. The issue seems to have been resolved and we no longer need to pin to a specific version.

* update version

* regenerate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants