Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

ReferenceError after upgrading dependencies #984

Closed
armenzg opened this issue Jul 5, 2018 · 6 comments
Closed

ReferenceError after upgrading dependencies #984

armenzg opened this issue Jul 5, 2018 · 6 comments

Comments

@armenzg
Copy link

armenzg commented Jul 5, 2018

Bug

Please try to answer the following questions:

  • What version of Neutrino are you using? 8.3.0
  • Are you trying to use any presets? If so, which ones, and what versions?
    • "@neutrinojs/airbnb-base": "^8.3.0",
    • "@neutrinojs/mocha": "^8.3.0",
    • "@neutrinojs/node": "^8.3.0",
  • Are you using the Yarn client or the npm client? What version? yarn 1.7.0
  • What version of Node.js are you using? v8.11.3
  • What operating system are you using? Mac OS X
  • What did you do? Upgraded from 8.0.18 to 8.3.0 and running tests or starting the project started to fail
  • What did you expect to happen? Tests and building to work as usual
  • What actually happened, contrary to your expectations? It failed. See log at the end.

I've pushed a branch to my repo which you can use to reproduce:
https://github.com/armenzg/firefox-health-backend/tree/neutrino

I'm happy to wait for version 9 rather than upgrading now.

armenzg@armenzg-mbp backend$ yarn test:src
yarn run v1.7.0
$ neutrino test
/Users/armenzg/repos/health/backend/node_modules/babel-core/lib/transformation/file/index.js:558
      throw err;
      ^

ReferenceError: /Users/armenzg/repos/health/backend/src/release/updates.js: unknown node of type "Literal" with constructor "Object"
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:279:13)
    at Generator.MemberExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/expressions.js:229:10)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.AssignmentExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/expressions.js:190:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.MemberExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/expressions.js:216:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.UnaryExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/expressions.js:43:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.AssignmentExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/expressions.js:190:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.IfStatement (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/statements.js:45:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.printJoin (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:366:12)
    at Generator.printSequence (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:420:17)
    at Generator.BlockStatement (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/base.js:43:10)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.FunctionExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/methods.js:84:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.printJoin (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:366:12)
    at Generator.printSequence (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:420:17)
    at Generator.BlockStatement (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/base.js:43:10)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.FunctionExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/methods.js:84:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.printJoin (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:366:12)
    at Generator.printList (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:430:17)
    at Generator.NewExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/expressions.js:87:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.ReturnStatement (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/statements.js:159:12)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.printJoin (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:366:12)
    at Generator.printSequence (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:420:17)
    at Generator.BlockStatement (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/base.js:43:10)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.FunctionExpression (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/methods.js:84:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.printJoin (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:366:12)
    at Generator.printSequence (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:420:17)
    at Generator.Program (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/base.js:28:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.File (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/generators/base.js:19:8)
    at /Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:298:23
    at Buffer.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/buffer.js:168:5)
    at Generator.withSource (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:189:15)
    at Generator.print (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:297:10)
    at Generator.generate (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/printer.js:85:10)
    at Generator.generate (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/index.js:62:40)
    at exports.default (/Users/armenzg/repos/health/backend/node_modules/babel-generator/lib/index.js:20:14)
    at File.generate (/Users/armenzg/repos/health/backend/node_modules/babel-core/lib/transformation/file/index.js:676:19)
    at File.transform (/Users/armenzg/repos/health/backend/node_modules/babel-core/lib/transformation/file/index.js:522:17)
    at /Users/armenzg/repos/health/backend/node_modules/babel-core/lib/transformation/pipeline.js:50:19
    at File.wrap (/Users/armenzg/repos/health/backend/node_modules/babel-core/lib/transformation/file/index.js:532:16)
    at Pipeline.transform (/Users/armenzg/repos/health/backend/node_modules/babel-core/lib/transformation/pipeline.js:47:17)
    at Object.transformFileSync (/Users/armenzg/repos/health/backend/node_modules/babel-core/lib/api/node.js:152:10)
    at compile (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:118:20)
    at loader (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/armenzg/repos/health/backend/src/release.js:2:1)
    at Module._compile (module.js:652:30)
    at loader (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/armenzg/repos/health/backend/src/app.js:11:1)
    at Module._compile (module.js:652:30)
    at loader (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/armenzg/repos/health/backend/test/android/klar.test.js:3:1)
    at Module._compile (module.js:652:30)
    at loader (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/armenzg/repos/health/backend/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /Users/armenzg/repos/health/backend/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/armenzg/repos/health/backend/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/Users/armenzg/repos/health/backend/node_modules/mocha/lib/mocha.js:536:10)
    at Object.<anonymous> (/Users/armenzg/repos/health/backend/node_modules/mocha/bin/_mocha:573:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@edmorley
Copy link
Member

edmorley commented Jul 5, 2018

Googling the error message returns MatAtBread/fast-async#23.

I suspect your lockfile contains out of date dependencies - could you remove it and regenerate? (I'd recommend regenerating it on a schedule using something like https://renovatebot.com/)

@edmorley
Copy link
Member

edmorley commented Jul 5, 2018

Refreshing the lockfile doesn't fix it for me. Looking closer.

@edmorley
Copy link
Member

edmorley commented Jul 5, 2018

This reproduces for me using Neutrino 8.0.18 (ie even without the 8.3.0 upgrade), after just refreshing the lockfile. ie:

  1. git clone https://github.com/mozilla/firefox-health-backend
  2. Edit package.json such that the various Neutrino package versions are 8.0.18 rather than ^8.0.18, and for completeness, ensure that all subdependency Neutrino packages resolve to the older version too, by adding this to package.json as well (this step won't be necessary for Neutrino 9, thanks to Use lerna exact mode & bump version to 9.0.0-0 prerelease #958):
  "resolutions": {
    "@neutrinojs/airbnb-base": "8.0.18",
    "@neutrinojs/banner": "8.0.18",
    "@neutrinojs/clean": "8.0.18",
    "@neutrinojs/compile-loader": "8.0.18",
    "@neutrinojs/copy": "8.0.18",
    "@neutrinojs/eslint": "8.0.18",
    "@neutrinojs/hot": "8.0.18",
    "@neutrinojs/loader-merge": "8.0.18",
    "@neutrinojs/mocha": "8.0.18",
    "@neutrinojs/node": "8.0.18",
    "@neutrinojs/start-server": "8.0.18",
    "neutrino": "8.0.18"
  },
  1. rm -rf yarn.lock node_modules/ && yarn
  2. yarn test:src

As such, it seems like a non-Neutrino in-range subdependency update is what is causing the breakage here, and not Neutrino itself.

@edmorley
Copy link
Member

edmorley commented Jul 5, 2018

Ok, so the error goes away if I comment out the result[channel] = await getUpdate(channel); here:
https://github.com/mozilla/firefox-health-backend/blob/17fe887be81154013a81af933478da34a2c0ee7d/src/release/updates.js#L24-L30

Also, when I disable the usage of fast-async, the error no longer occurs:

    [
      '@neutrinojs/node',
      {
        polyfills: {
          async: false,
        },
        // ...
    ]

So it looks like a in-semver-range update of either fast-async or one of the babel packages causes the construct above to now fail.

To work around, you can disable the fast-async babel plugin per the above. So long as you're using Node 8+ (or a recent browser) you don't actually need any transformation of async, since it's supported natively (which is why #790 removes our use of it for Neutrino 9).

@armenzg
Copy link
Author

armenzg commented Jul 5, 2018

Thanks for looking into it!
It works as described.

@edmorley
Copy link
Member

edmorley commented Jul 5, 2018

I've created a reduced testcase and opened MatAtBread/fast-async#58. This appears to be a regression in nodent-compiler@3.2.0 - rolling it back to nodent-compiler@3.1.8 fixes the issue.

@edmorley edmorley changed the title Regression after upgrading to 8.3.0 from 8.0.18 ReferenceError after upgrading dependencies Jul 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants