[SOLVED] Stack traces in Tracker compute funcs

Does anyone have a solution for figuring out which template or file a tracker’s in, or ideally, a file & line number?

Example trace:

Error: No such function: foo
    at http://www.dev.com:3000/packages/blaze.js?hash=a20deb597f76789e171a9ee2b2e37d73fbb7ecda:3012:15
    at Spacebars.call (http://www.dev.com:3000/packages/spacebars.js?hash=6f2be25813c793c0b363a6a91ebb029723f294ec:172:18)
    at Spacebars.mustacheImpl (http://www.dev.com:3000/packages/spacebars.js?hash=6f2be25813c793c0b363a6a91ebb029723f294ec:106:25)
    at Object.Spacebars.dataMustache (http://www.dev.com:3000/packages/spacebars.js?hash=6f2be25813c793c0b363a6a91ebb029723f294ec:138:39)
    at http://www.dev.com:3000/app/app.js?hash=6849b16612fb00d8fbad5f2a97dd99d1fea41e2f:21292:24
    at Blaze.View.<anonymous> (http://www.dev.com:3000/packages/blaze.js?hash=a20deb597f76789e171a9ee2b2e37d73fbb7ecda:2535:44)
    at http://www.dev.com:3000/packages/blaze.js?hash=a20deb597f76789e171a9ee2b2e37d73fbb7ecda:1778:18
    at Function.Template._withTemplateInstanceFunc (http://www.dev.com:3000/packages/blaze.js?hash=a20deb597f76789e171a9ee2b2e37d73fbb7ecda:3575:14)
    at http://www.dev.com:3000/packages/blaze.js?hash=a20deb597f76789e171a9ee2b2e37d73fbb7ecda:1777:29
    at Object.Blaze._withCurrentView (http://www.dev.com:3000/packages/blaze.js?hash=a20deb597f76789e171a9ee2b2e37d73fbb7ecda:2109:12) undefined

There is no useful information here from what I can glean – no indication of which template, file or line number. Have there been no improvements here since 2015? If I’m doing something wrong I’d love to know what it is as I run into this any time I’m writing trackers, which is a lot. The best I can do is to grep my codebase for foo in this case.

Thanks eveyrone.

is this on your local computer? which command did you use to run the meteor server? It looks like you’re running a production build.

Yes, local machine. If ‘dev.com’ is confusing things, that’s just a fake domain for the app. It’s irrelevant.

SERVER_NODE_OPTIONS='--trace-uncaught' meteor run --inspect --settings dev.json --raw-logs

Since the files in the stack trace look like they all point to bundles, this one looks like it’s pointing at your application code bundle (instead of meteor or package internals), so if you catch it in the console you should be able to click it and the browser should use the sourcemap to jump to the location in code where the tracker function is declared.

    at http://www.dev.com:3000/app/app.js?hash=6849b16612fb00d8fbad5f2a97dd99d1fea41e2f:21292:24

Unfortunately it’s hard for error traces to identify the context where the function was defined, since it is passed and stored as a variable and called later on, so the actual stack at that time doesn’t have the location where the function was created

3 Likes

I’m not sure but I would check if the node environment is production or not.

I think it’s unlikely but who knows? Nope, doesn’t look like it:
console.log(process.env.NODE_ENV)
development

1 Like

I somehow wasn’t clicking on that one. The code there is relevant and useful. Thanks!