-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Using esm (ES6 modules) causes failure. #3382
Comments
I can't reproduce this. I did renamed screenshot.js into screenshot.mjs. I replaced the require with an import. I ran it with |
I can reproduce this using Puppeteer 1.9.0 with ava using ESM import statements. |
Same. Puppeteer version: v1.9.0 I had to revert back to Puppeteer v1.8.0 from v1.9.0 to get back to a working state. |
I also have this situation.When the high concurrent operation, it will report this exception from time to time, so annoying |
I'm wondering why you use the This works:
This does not:
|
I’m using ava, which controls Node and compilation. This is the relevant issue: The error we’re seeing:
|
@Rob-pw: please use the --experimental-modules. This is the way forward with ESM in node.js AVA users: there's avajs/ava#1810 that covers ESM support in ava. |
+1 on this, @Rob-pw thanks for spotting it: after bumping to 1.9.0 I really had no idea where this error was coming from. |
Hi @aslushnikov! 👋 Node core and Node Module WG member here. There is no set date for when The I'm open to digging into it from the |
@aslushnikov after digging into the code I noted that this does not seem to not be related to ESM but to this line into into
Replacing the following into https://github.com/GoogleChrome/puppeteer/blob/d547b9d24a803c0adf923b3a821ae5f43e79bb53/lib/Connection.js#L50 solves the issue
But I'm not sure whether that makes "logic" sense. |
@jdalton awesome, reopening.
Thanks to @damianobarbati input, I've debugged it down to d547b9d. The core issue seems to be that Here's a small snippet from @jdalton any ideas what's going on here? |
Thanks @aslushnikov! I narrowed it down to a faulty |
@jdalton awesome, thank you for your time! Do you plan to release a new version of |
Yes, likely within a |
…ss npx babel-node will overcome) - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
@jdalton is the release done? |
Well that week-or-so turned into a bit longer with the US Thanksgiving holiday. I should release before I start more aggressive perf work. I'll ping back this thread when it's released. |
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
…ss npx babel-node will overcome); For startsWith/endsWith requires: - Breaking change: Require `@babel/polyfill` - Breaking change (minor): `svg.Property` (2nd arg) (and `svg.ViewPort.ComputeSize` (1st arg)) may only accept string literals (no String objects) - Enhancement: Add ESM distribution file (and point to it from `package.json` `module`) and Babelify source - Linting (ESLint): Rename to `.js` to allow commenting - Linting (ESLint): Apply most of strict `ash-nazg/sauron` linting (consistent semicolons, single quotes; prefer const then let; object destructuring and shorthand; avoid eqeq, quoted properties, and unnecessary parentheses; space before comments; Unicode regexes; parentheses with `new`; avoid shadowing; switch indents; guard for-in; avoid direct use of `hasOwnProperty`; fix JSDoc; import order based on import type; prefer exponentiation operator, startsWith/endsWith, addEventListener; avoid unsafe regex) - Refactoring: Make clear that `getBoundingBox` and `elementTransform` of `svg.Element.use` and `svg.Element.tref.getText` return `undefined` in some cases - Docs: Lint JS in README - npm: Update nested packages
I don't think we can do anything else on the puppeteer-side for this. Once @jdalton publishes a new version of esm, the issue will be mitigated. |
BTW, I had this issue with puppeteer Chromium 71 / Ava 1.0.1 / Puppetter 1.11.0 / Docker / Node 10.15.0-alpine |
👋 Hello @jdalton! We have a script using puppeteer, it was working great with We got this error:
Any idea? Thanks in advance! 🙏 Update: I just found the related issue in the |
Is ESM currently working? @aslushnikov |
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
Please include code that reproduces the issue.
const puppeteer = require('puppeteer')
withìmport puppeteer from 'puppeteer'
node -r esm example.js
What is the expected result?
Empty prompt,
example.png
in script folder.What happens instead?
The text was updated successfully, but these errors were encountered: