abracadabrax
abracadabrax

Reputation: 163

How to get a more meaningful stack trace than "line 4308490384 of bundle.js"?

I am working on a very tangled Angular 4.4 application. It blows up and this is the stack trace that I am getting:

ERROR Error: "[object Object]"
    resolvePromise http://localhost:4300/polyfills.bundle.js:7118
    resolvePromise http://localhost:4300/polyfills.bundle.js:7075
    scheduleResolveOrReject http://localhost:4300/polyfills.bundle.js:7179
    invokeTask http://localhost:4300/polyfills.bundle.js:6710
    onInvokeTask http://localhost:4300/vendor.bundle.js:370092
    invokeTask http://localhost:4300/polyfills.bundle.js:6709
    runTask http://localhost:4300/polyfills.bundle.js:6482
    drainMicroTaskQueue http://localhost:4300/polyfills.bundle.js:6888
    invokeTask http://localhost:4300/polyfills.bundle.js:6789
    invoke http://localhost:4300/polyfills.bundle.js:6774
    timer http://localhost:4300/polyfills.bundle.js:8568
vendor.bundle.js:367231:19

How can I get anything more meaningful that [object object] at line 367231 of bundle.js?

FWIW, this particular line is trying to console.log a values variable which turns out to be a function that returns empty string when executed. it seems to be code internal to angular because it has (c) Google all over the comments.

I have tried running ng serve --build-optimizer=false but it still optimizes. I don't see an option in my .angular-cli.json to toggle this either.

I also don't understand why it seems to build sourcemaps but they're not picked up to give a meaningful trace:

Date: 2019-12-17T14:39:51.960Z
Hash: 436f24accaf17c10807d
Time: 22366ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 332 kB {vendor} [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 365 kB {inline} [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 1.02 MB {inline} [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 15.4 MB [initial] [rendered]

Upvotes: 2

Views: 417

Answers (1)

abracadabrax
abracadabrax

Reputation: 163

The solution is to use Chrome... As much as I think Chrome is bad for the internet, this fixed the problem. It shows the actual error rather than [object Object] and uses the sourcemaps to show the exact spot in the original code rather than in the minified bundled artifact.

Upvotes: 2

Related Questions