ember-angle-brackets-codemod icon indicating copy to clipboard operation
ember-angle-brackets-codemod copied to clipboard

Async error

Open Yelinz opened this issue 5 years ago • 7 comments
trafficstars

When i run any command this error comes up

(node:1259) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'entries' of undefined
    at __puppeteer_evaluation_script__:9:50
    at ExecutionContext._evaluateInternal (/home/yelin/.npm/_npx/1259/lib/node_modules/ember-angle-brackets-codemod/node_modules/puppeteer/lib/ExecutionContext.js:122:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at ExecutionContext.<anonymous> (/home/yelin/.npm/_npx/1259/lib/node_modules/ember-angle-brackets-codemod/node_modules/puppeteer/lib/helper.js:111:15)
    at DOMWorld.evaluate (/home/yelin/.npm/_npx/1259/lib/node_modules/ember-angle-brackets-codemod/node_modules/puppeteer/lib/DOMWorld.js:112:20)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Frame.<anonymous> (/home/yelin/.npm/_npx/1259/lib/node_modules/ember-angle-brackets-codemod/node_modules/puppeteer/lib/helper.js:111:15)
    at Page.evaluate (/home/yelin/.npm/_npx/1259/lib/node_modules/ember-angle-brackets-codemod/node_modules/puppeteer/lib/Page.js:833:43)
    at Page.<anonymous> (/home/yelin/.npm/_npx/1259/lib/node_modules/ember-angle-brackets-codemod/node_modules/puppeteer/lib/helper.js:112:23)
    at bridgeEvaluate (/home/yelin/.npm/_npx/1259/lib/node_modules/ember-angle-brackets-codemod/node_modules/ember-codemods-telemetry-helpers/lib/gather/gather-telemetry.js:66:17)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1259) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1259) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Yelinz avatar Feb 14 '20 15:02 Yelinz

Go the exact same error, tried with release 4.1.0 and 3.1.2.

tomdrn avatar Feb 24 '20 16:02 tomdrn

@Yelinz can you show us the command you entered?

abulrim avatar Mar 23 '20 13:03 abulrim

As i said any command, so whatever is in the README and any variation of it. e.g. npx ember-angle-brackets-codemod http://localhost:4200 ./path/of/files/ or ./some**/*glob.hbs

Yelinz avatar Mar 23 '20 14:03 Yelinz

I'm seeing the same issue -- if I run the following

npx ember-angle-brackets-codemod --telemetry=http://localhost:9999 ./addon

(Our app runs on port 9999, hence the slight different from the normal usage there)

I get the same error about entries being accessed on undefined.

My guess is that the issue is here:

https://github.com/ember-codemods/ember-codemods-telemetry-helpers/blob/a1ae780e23e9fec88112679d34277092e51690c2/lib/gather/gather-telemetry.js#L36

And that, for some reason, window.require is not yet defined at the point that that line is being evaluated.

alexlafroscia avatar Jun 29 '20 18:06 alexlafroscia

I was getting this as well and found it was due to the Puppeteer version using Chrome 78.0 and our build target was only to the last 1 Chrome version which made our build incompatible with Chrome 78.0.

rjschie avatar Jul 14 '20 22:07 rjschie

Huh, good call-out there @rjschie! I bet that could be what the issue for me is, too -- our app is set up to just use the last 1 chrome version in development mode.

alexlafroscia avatar Jul 17 '20 16:07 alexlafroscia

~~Unfortunately we're still seeing the issue even with two different "fixes" attempted~~

  1. ~~Setting our browsers list for the development build to Chrome >= 78~~
  2. ~~Cloning the code-mod locally and overriding the dependency on ember-codemods-telemetry-helpers to pull from the master on GitHub, where an update to Puppeteer has landed thanks to @rjschie (the update hasn't actually been released to npm yet)~~

False alarm; an issue in our app's configuration was the reason it was breaking.

With the above steps applied, the codemod worked for me! 🎉

alexlafroscia avatar Aug 18 '20 15:08 alexlafroscia