ember-cli-addon-guard
ember-cli-addon-guard copied to clipboard
Incompatibility between `ember-cli-addon-guard` and `ember-intl` >= `4.2.1`
The problem
On a project containing [email protected]
and [email protected]
, when starting my Ember server, I get an error Cannot read property 'paths' of undefined
, with this stack trace:
- broccoliBuilderErrorStack: [undefined]
- code: [undefined]
- codeFrame: [undefined]
- errorMessage: Cannot read property 'paths' of undefined
- errorType: [undefined]
- location:
- column: [undefined]
- file: [undefined]
- line: [undefined]
- message: Cannot read property 'paths' of undefined
- name: TypeError
- nodeAnnotation: [undefined]
- nodeName: [undefined]
- originalErrorMessage: [undefined]
- stack: TypeError: Cannot read property 'paths' of undefined
at Class.cacheKeyForTree (/Users/dan.nye/new/Documents/code/platform/node_modules/ember-intl/index.js:47:32)
at traverseAddons (/Users/dan.nye/new/Documents/code/platform/node_modules/ember-cli-addon-guard/lib/utils/review-project.js:54:66)
at traverseAddons (/Users/dan.nye/new/Documents/code/platform/node_modules/ember-cli-addon-guard/lib/utils/review-project.js:76:13)
at traverseAddons (/Users/dan.nye/new/Documents/code/platform/node_modules/ember-cli-addon-guard/lib/utils/review-project.js:76:13)
at traverseAddons (/Users/dan.nye/new/Documents/code/platform/node_modules/ember-cli-addon-guard/lib/utils/review-project.js:76:13)
at Object.reviewProject [as default] (/Users/dan.nye/new/Documents/code/platform/node_modules/ember-cli-addon-guard/lib/utils/review-project.js:28:5)
at Class.included (/Users/dan.nye/new/Documents/code/platform/node_modules/ember-cli-addon-guard/index.js:35:49)
at Class.superWrapper [as included] (/Users/dan.nye/new/Documents/code/platform/node_modules/core-object/lib/assign-properties.js:34:20)
at /Users/dan.nye/new/Documents/code/platform/node_modules/ember-cli/lib/broccoli/ember-app.js:629:15
at Array.forEach (<anonymous>)
The diagnosis
Adding in some logging, it appears that when ember-cli-addon-guard
tries to call ember-intl
's cacheKeyForTree
method, an error is thrown because the cacheKeyForTree
method refers to a property that is only set up if the included
method is called first.
Reproduction steps
I've tried on our setup:
I've also tried the same but with our target Ember upgrade versions:
I've also tried using out-of-the-box LTS versions of Ember and Node:
-
[email protected]
-
[email protected]
-
[email protected]
-
[email protected]
-
[email protected]
-
[email protected]
In all cases, running ember s
will throw the above error.
Where to go from here
I'm trying to work out which addon is at fault here - ember-intl
or ember-cli-addon-guard
. I'm leaning towards ember-intl
being the culprit, as neither https://rfcs.emberjs.com/id/0090-addon-tree-caching/ nor https://ember-cli.com/api/classes/addon#method_cacheKeyForTree state that included
should be called before cacheKeyForTree
in order for cacheKeyForTree
to work.
As such, I've raised https://github.com/ember-intl/ember-intl/issues/1926. However, I thought it worth raising this bug here for two reasons:
- I could be wrong, and it could well be that
included
should always be called beforecacheKeyForTree
- Anyone with the same problem searching issues here will hopefully come across this and save themselves some head scratching.
If you don't think that this is an ember-cli-addon-guard
issue, please feel free to close this bug report.