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

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

Open
aradice-truenorth opened this issue Jun 21, 2021 · 2 comments

Comments

@aradice-truenorth
Copy link

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?

@bathan
Copy link

bathan commented Jul 15, 2022

Having the exact same issue. Some defensive code around those lines would be greatly apprecciated.

@KotanaSai21
Copy link

KotanaSai21 commented Jun 6, 2023

This Issue is with the windows-post-message-proxy and it has been fixed with the latest beta release windows-post-message-proxy-npm-0.2.7

Try installing the latest version powerbi-client: 2.22.4
Refer powerbi-client-npm

LMK if the issue still exists.

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