ember-codemods / ember-angle-brackets-codemod

Codemod to convert curly braces syntax to angle brackets syntax
MIT License
60 stars 32 forks source link

Async error #243

Open Yelinz opened 4 years ago

Yelinz commented 4 years ago

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.
tomdrn commented 4 years ago

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

abulrim commented 4 years ago

@Yelinz can you show us the command you entered?

Yelinz commented 4 years ago

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

alexlafroscia commented 4 years ago

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.

rjschie commented 4 years ago

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.

alexlafroscia commented 4 years ago

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 commented 4 years ago

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! 🎉