Skip to content

Uncaught (in promise): TypeError: Cannot read property 'postMessage' of null #48

@aradice-truenorth

Description

@aradice-truenorth

Our application has a dashboard which makes extensive use of NgxPowerBiService.embed to render "tile" views of reports which the user can click to view the full report, a screen which makes use of NgxPowerBiComponent. This generally works very well, and we really like these components; thank you very much for developing them and making them publicly available 🥇 !

We have discovered an issue which is easy to reproduce but not in a very scientific manner: if we click around rapidly from screen to screen we encounter errors like:

Last error : Uncaught (in promise): TypeError: Cannot read property 'postMessage' of null at t.sendResponse (https://pplcmslp3web.azurewebsites.net/main-es2015.db324120385304cf3c46.js:1:404048) at https://pplcmslp3web.azurewebsites.net/main-es2015.db324120385304cf3c46.js:1:405623 at l.invoke (https://pplcmslp3web.azurewebsites.net/polyfills-es2015.18568f7b8173e068193a.js:1:7269) at Object.onInvoke (https://pplcmslp3web.azurewebsites.net/main-es2015.db324120385304cf3c46.js:1:709205) at l.invoke (https://pplcmslp3web.azurewebsites.net/polyfills-es2015.18568f7b8173e068193a.js:1:7209) at i.run (https://pplcmslp3web.azurewebsites.net/polyfills-es2015.18568f7b8173e068193a.js:1:2681) at https://pplcmslp3web.azurewebsites.net/polyfills-es2015.18568f7b8173e068193a.js:1:13613 at l.invokeTask (https://pplcmslp3web.azurewebsites.net/polyfills-es2015.18568f7b8173e068193a.js:1:7887) at Object.onInvokeTask (https://pplcmslp3web.azurewebsites.net/main-es2015.db324120385304cf3c46.js:1:709021) at l.invokeTask (https://pplcmslp3web.azurewebsites.net/polyfills-es2015.18568f7b8173e068193a.js:1:7808)

The exception is thrown by line 1 char 404048 of main.js which is (when pretty printed):

t.prototype.sendResponse = function(t, e, n) { this.addTrackingProperties(e, n), this.logMessages && (console.log(this.name + " Sending response:"), console.log(JSON.stringify(e, null, " "))), t.postMessage(e, "*") }

It looks like the error is occuring when an iframe that contained a report or a tile is no longer present when a message needs to be sent to that iframe by the container webpage. We don't want to log or display these errors and it's a bit of a pain weeding them out; is there any way that the component could be updated to swallow them silently?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions