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

Warning: Cannot call method 'trace' of undefined #10

Closed
JohnLouderback opened this issue May 17, 2015 · 6 comments
Closed

Warning: Cannot call method 'trace' of undefined #10

JohnLouderback opened this issue May 17, 2015 · 6 comments

Comments

@JohnLouderback
Copy link

When running this syncronously:

var chain = sorcery.loadSync(temp + 'test.js');
chain.apply();

I get the error:

Warning: Cannot call method 'trace' of undefined

strangely, logging console.log(chain.__proto__) shows the trace is, in fact, a method of chain.

@Rich-Harris
Copy link
Owner

It's a method of Chain.prototype, but also a method of Node.prototype - internally, files are represented as 'nodes', and node.trace() is what chain.trace() delegates to. If a node finds a mapping to a 'parent' node (meaning closer to the original source), it traces that - so it sounds like what's happening is that we have a mapping with a source index of x, but node.sources[x] doesn't exist.

I've seen a similar error once or twice, but never at a moment when I've had time to stop what I'm doing and dig into it! Any chance you would be able to share a minimal reproduction of the bug, so I can investigate? Thanks

@JohnLouderback
Copy link
Author

Sure thing. Here's a minimal and realworld example

https://www.dropbox.com/s/wrh0yhm1f537wj8/sorcery-debug.zip?dl=0

@Rich-Harris
Copy link
Owner

Awesome, thank you. Will look into this as soon as time allows

@JohnLouderback
Copy link
Author

Hey Rich,

Any news on this?

@Rich-Harris
Copy link
Owner

@JohnLouderback Sorry for the crazy delay on this, been up to the gills lately. The repro you provided was very helpful in getting to the bottom of this - the fix is in, just released it as 0.6.2.

@JohnLouderback
Copy link
Author

Just wanted to swing by and say "Thanks!". This works like a charm. I'm extremely grateful. Awesome tool.

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

2 participants