Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Problem using page.getFilters()

Hello,

 

So I'm having an issue where I can get a report embedded, and (as shown in the image) I can perform a getPages() on the report and it returns the explected results of enumerating the pages from the report. So then I pull out a particular page using the page(<pageName>) function and assign it to a variable, the problem comes in when I try to use page.getFilters() for some reason the promise is being broken, and so I am unable to get the filters that are on the page. I never had any trouble with this previously so I'm not sure what changed, but I'd really wish it would go back to just working.

 

 

Capture.PNG

12 REPLIES 12
Rich2852
Frequent Visitor

I'm also having the same issue in my application. I noticed Power Bi was reporting a fault on Friday about filtering if you were using custom visuals. I've created a new report, with no custom visuals and just one graph and I'm getting the same issue when filtering:

 

reportEmbed.min.js:1 Unhandled Promise rejection: Failed to execute 'postMessage' on 'Window': TypeError: Cannot read property 'instanceOfIVisualLevel' of undefined could not be cloned. ; Zone: <root> ; Task: Promise.then ; Value: DOMException: Failed to execute 'postMessage' on 'Window': TypeError: Cannot read property 'instanceOfIVisualLevel' of undefined could not be cloned.
    at e.sendResponse (https://app.powerbi.com/13.0.6617.130/externals/windowPostMessageProxy.min.js:2:3035)
    at https://app.powerbi.com/13.0.6617.130/externals/windowPostMessageProxy.min.js:2:4753
    at t.invoke (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:449376)
    at e.run (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:444540)
    at https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:455835
    at t.invokeTask (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:450060)
    at e.runTask (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:445234)
    at v (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:452421)
    at e.invokeTask (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:451223)
    at i.isUsingGlobalCallback.invoke (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:451082) Error: Failed to execute 'postMessage' on 'Window': TypeError: Cannot read property 'instanceOfIVisualLevel' of undefined could not be cloned.
    at e.sendResponse (https://app.powerbi.com/13.0.6617.130/externals/windowPostMessageProxy.min.js:2:3035)
    at https://app.powerbi.com/13.0.6617.130/externals/windowPostMessageProxy.min.js:2:4753
    at t.invoke (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:449376)
    at e.run (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:444540)
    at https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:455835
    at t.invokeTask (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:450060)
    at e.runTask (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:445234)
    at v (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:452421)
    at e.invokeTask (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:451223)
    at i.isUsingGlobalCallback.invoke (https://app.powerbi.com/13.0.6617.130/scripts/reportEmbed.min.js:1:451082)

I have logged a support case with microsoft. They are looking into a fix but they have the following work around:

 

Customers may receive an error while setting or getting page-level filters or visual-level filters using the Power BI embedded javascript API. As a workaround, customers can pass in any filter object in load config. Engineers are investigating the issue. Next update @ 9/10/18 at 9:00AM PDT.

 

https://powerbi.microsoft.com/en-us/support/


@Rich2852 wrote:

I have logged a support case with microsoft. They are looking into a fix but they have the following work around:

 


@Rich2852 if I could give you +100 Kudos, I would! You are a legend! Let's hope the Power BI team comes out with a fix sooner rather than later, and hopefully some regression testing to ensure this doesn't happen again!

Anonymous
Not applicable

For everyone interested, I'm assuming that the issue causing this forum thread is related to the last Awareness item listed on this page https://powerbi.microsoft.com/en-us/support/

Customers using Power BI Embedded APIs to set report filters may experience error applying filters. This issue happens only if a report has Custom visuals. The fix will be deployed to production by end of day on 9/7. Next update @ 9/7/18 at 16:00 PDT.

 

So I'm not sure there's going to be any resolution before then.

Thanks for spotting that @Anonymous ! I'm pretty certain that I'm not using custom visuals at all... but might be the best hope for a resolution at the moment.

This is still a problem.

This is an interesting Stack Overflow discussion...

 

https://stackoverflow.com/questions/52122011/failed-to-execute-postmessage-on-window-googletagmanage...

 

Specifically about Google Tag Manager, but a similar error, and alot of people reporting this RECENTLY.

 

Another SO post...

 

https://stackoverflow.com/questions/52184392/powerbi-javascript-set-page-filters-without-set-report-...

 

Suggests the issue is with attempting to set a page filter BEFORE a report filter - and says that this can be reproduced on Microsoft's own hosted samples!

 

Also consider: https://stackoverflow.com/questions/52122011/failed-to-execute-postmessage-on-window-googletagmanage...

Anonymous
Not applicable

I'm still running into issues with this, but I've been able to find a workaround, once the user interacts with the page and applies a filter, then the getFilters() function started returning working promises again.

YES! I am also having a similar problem!!! However my issue is with a call to setFilters(). It was previously working fine but something appears to now be broken, without any change being applied by us.

 

Failed to execute 'postMessage' on 'Window': TypeError: cannot read property 'instanceOfIVisualLevel' of undefined could not be cloned."

 

If any Power BI MS devs are reading this... please investigate ASAP!

 

I have updated our code to the latest version of the Power BI Javascript API, but still appears to be broken.

I can confirm that in my case;

 

1. page.setFilters() and visual.setFilters() are the methods that I am calling first.

2. These all fail with the errors identified above by the OP.

3. If the user interacts with the report (i.e. does some clicking), and then interacts with our HTML controls that are outside the Power BI Embedded iframe (i.e. and call the Power BI Javascript API in response to the updates) then the next calls to page.setFilters(), visual.setFilters() work successfully.

 

MS Power BI team, PLS HALP!

Can someone look into this, because it really does feel like something has broken in the back-end that has caused our app to break without any other changes having been made.

I'm having the same problem. When calling page.getFilters() and page.setFilters()..

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.