Skip to content
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

TypeError: Invalid value used as weak map key, in get() with canary #14557

Closed
backspace opened this issue Oct 31, 2016 · 5 comments
Closed

TypeError: Invalid value used as weak map key, in get() with canary #14557

backspace opened this issue Oct 31, 2016 · 5 comments

Comments

@backspace
Copy link

Hey, I’ve been trying out the Ember beta and canary versions with travis-web and getting a WeakMap error. When I run with canary in bower.js in Chrome 56, I get this stacktrace:

WeakMap_setMeta (ember.debug.js:19145)
meta (ember.debug.js:19246)
watchKey (ember.debug.js:22349)
RootPropertyReference (ember.debug.js:14278)
get (ember.debug.js:14184)
referenceFromParts (ember.debug.js:44196)
evaluate (ember.debug.js:46140)
evaluate (ember.debug.js:45613)
evaluateArgs (ember.debug.js:53312)
evaluate (ember.debug.js:48694)
execute (ember.debug.js:53279)
RootState.render (ember.debug.js:11301)
runInTransaction (ember.debug.js:22272)
_renderRoots (ember.debug.js:11566)
_renderRootsTransaction (ember.debug.js:11604)
_renderRoot (ember.debug.js:11525)
_appendDefinition (ember.debug.js:11438)
appendOutletView (ember.debug.js:11421)
invoke (ember.debug.js:337)
flush (ember.debug.js:407)
flush (ember.debug.js:531)
end (ember.debug.js:601)
run (ember.debug.js:724)
fire (jquery.js:3187)
fireWith (jquery.js:3317)
ready (jquery.js:3536)
completed (jquery.js:3552)

Similar errors happen with Safari, Firefox, and Chrome 53.

This can be reproduced with the repository running locally with beta or canary as the Ember version in bower.json. When I enable pausing on exceptions, I see that the get is on a property key of config:

image

I’ve been working on permanent beta and canary production environment deployments of Ember, which are failing differently with this error:

ember.prod.js:20058 Uncaught TypeError: Cannot read property 'config' of undefined

The presence of config there makes me wonder if they’re somehow related though, but the stack trace is pretty different:

Production canary stacktrace ``` r (ember.prod.js:20058) t.compute (ember.prod.js:13338) t.value (ember.prod.js:13213) t.compute (ember.prod.js:13376) t.value (ember.prod.js:13213) e.value (ember.prod.js:47770) e.initialize (ember.prod.js:41539) e.peek (ember.prod.js:41513) t.evaluate (ember.prod.js:46085) e.execute (ember.prod.js:50289) d (ember.prod.js:49863) render (ember.prod.js:10524) h (ember.prod.js:10477) e._renderRoots (ember.prod.js:10787) e._renderRootsTransaction (ember.prod.js:10825) e._renderRoot (ember.prod.js:10746) e._appendDefinition (ember.prod.js:10659) e.appendOutletView (ember.prod.js:10642) invoke (ember.prod.js:326) flush (ember.prod.js:396) flush (ember.prod.js:520) end (ember.prod.js:590) run (ember.prod.js:713) join (ember.prod.js:735) l.join (ember.prod.js:20411) (anonymous function) (ember.prod.js:20474) l (jquery.js:3187) fireWith (jquery.js:3317) ready (jquery.js:3536) a (jquery.js:3552) ```

I’m not familiar with this code so I haven’t gotten anywhere with trying to debug. Let me know if there’s any additional information I can provide.

@rwjblue
Copy link
Member

rwjblue commented Nov 1, 2016

I am not quite sure why yet, but we have a RootPropertyReference with a _parentValue of undefined.

When running ember.debug.js builds, we get the WeakMap_setMeta errors due to calling watchKey(undefined, 'config') (which then calls metaFor(undefined)).

When running ember.prod.js builds, we skip that and just call Ember.get(undefined, 'config') which errors (with the production config above).

A quick tour through the stack on ember-canary.travis-ci.org and the Ember codebase makes me think, that it is related to these references to config.enterprise in the templates, but again I haven't dug too much deeper to figure out why.

@backspace
Copy link
Author

hmm, well that config presumably comes from here. Is it a faux pas to reference the config in templates like this? This decision predates me and the addition of feature flags, which maybe could be used instead. But I see config. all over the place in templates. 😱

@rwjblue
Copy link
Member

rwjblue commented Nov 1, 2016

What y'all are doing seems fine, I was just doing a brain dump of my findings after a debugging session.

@krisselden
Copy link
Contributor

@backspace if you bower install ember#beta it should have the fix

@backspace
Copy link
Author

It’s true, excellent, thank you!

Sadly I’m getting another Invalid value used as weak map key seemingly related to config but it’s a different stacktrace, so I’ll open another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants