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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ejuang
New Member

Salesforce Embed Throwing Error from Power BI JS Library

We have had an embedded Power BI report Lightning Web Component running for a few months, so far with just one report being displayed. Recently we tried to add another report but it appears that this report is causing an error to be thrown from within the PowerBI javascript library that we have as a static resource in the Salesforce org.

 

The embed token is being retrieved, and the report begins to render, but then throws multiple instances of the same aura component error. It appears that these graphics may be causing the isssue.

 

ejuang_0-1650556461812.png

Each of these components throw its own error, showing as an aura error modal. From that modal:

 

Uncaught Error in $A.getCallback() [a.indexOf is not a function]
throws at https://mycompany--test.lightning.force.com/auraFW/javascript/2yRFfs4WfGnFrNGn9C_dGg/aura_prod.js:129:15. Caused by: Error in $A.getCallback() [a.indexOf is not a function]
{anonymous}()@https://mycompany--test.lightning.force.com/auraFW/javascript/2yRFfs4WfGnFrNGn9C_dGg/aura_prod.js:944:191
b()@https://mycompany--test.lightning.force.com/auraFW/javascript/2yRFfs4WfGnFrNGn9C_dGg/aura_prod.js:946:72
$.C.ta()@https://mycompany--test.lightning.force.com/auraFW/javascript/2yRFfs4WfGnFrNGn9C_dGg/aura_prod.js:944:311
a()@https://mycompany--test.lightning.force.com/auraFW/javascript/2yRFfs4WfGnFrNGn9C_dGg/aura_prod.js:1025:196
{anonymous}()@https://mycompany--test.lightning.force.com/auraFW/javascript/2yRFfs4WfGnFrNGn9C_dGg/aura_prod.js:1025:389
Proxy.<anonymous>()@https://mycompany--test.lightning.force.com/auraFW/javascript/2yRFfs4WfGnFrNGn9C_dGg/aura_prod.js:100:90760
Object.raiseCustomEvent()@https://mycompany--test--c.visualforce.com/resource/1650479333000/PBIJS/PBIJS/PBIJS.js:1389:19
Service.handleEvent()@https://mycompany--test--c.visualforce.com/resource/1650479333000/PBIJS/PBIJS/PBIJS.js:619:21
eval()@https://mycompany--test--c.visualforce.com/resource/1650479333000/PBIJS/PBIJS/PBIJS.js:146:21
Object.routeRecognizerHandler()@https://mycompany--test--c.visualforce.com/resource/1650479333000/PBIJS/PBIJS/PBIJS.js:9777:46

 

 

We are using v2.11.0 of the PowerBI js library.

Code snippets, including line numbers from the above stack trace:

 

Router.prototype.registerHandler = function (
                    routeRecognizer,
                    method,
                    url,
                    handler
                  ) {
                    var routeRecognizerHandler = function (request) {
                      var response = new Response();
9777                    return Promise.resolve(handler(request, response)).then(
                        function (x) {
                          return response;
                        }
                      );
                    };
this.router.post("/reports/:uniqueId/events/:eventName", function (
              req,
              res
            ) {
              var event = {
                type: "report",
                id: req.params.uniqueId,
                name: req.params.eventName,
                value: req.body,
              };
146           _this.handleEvent(event);
            });
if (embed) {
              var value = event.value;
              if (event.name === "pageChanged") {
                var pageKey = "newPage";
                var page = value[pageKey];
                if (!page) {
                  throw new Error(
                    "Page model not found at 'event.value." + pageKey + "'."
                  );
                }
                value[pageKey] = new page_1.Page(
                  embed,
                  page.name,
                  page.displayName,
                  true /* isActive */
                );
              }
619           utils.raiseCustomEvent(embed.element, event.name, value);
            }
          };
function raiseCustomEvent(element, eventName, eventData) {
          var customEvent;
          if (typeof CustomEvent === "function") {
            customEvent = new CustomEvent(eventName, {
              detail: eventData,
              bubbles: true,
              cancelable: true,
            });
          } else {
            customEvent = document.createEvent("CustomEvent");
            customEvent.initCustomEvent(eventName, true, true, eventData);
          }
1389       element.dispatchEvent(customEvent);
        }

 

 After that, the stack trace leads into the aura js source, which is minified.

10 REPLIES 10
srikalak
New Member

Can you please post how this issue was resolved?

ejuang
New Member

In this case it turned out to be an issue with the report setup in Power BI, not in Salesforce. Another individual handles that for my organization, so I don't remember the exact nature of the problem, sorry.

FYI for any future lurkers! I encountered this same issue with my Salesforce admin. We have a number of Power BI reports deployed to a single Power BI workspace, with only one of them throwing the error that OP shared. I double-checked that all of the settings for the reports were the same, so I opened the report in question locally in Power BI desktop.

After checking all of the visuals in the report, including hidden visuals, I found that one in particular was referencing a column that was not present in the data model, as the visual was part of a visual group that was copied and pasted from another report. I changed the column reference to a column present in the data model, republished, and my Salesforce admin confirmed that the report was working again.

All of this to say, there is likely an error with a visual in the report somewhere. Just a reminder to check all visuals, whether visible or not.

what do you mean on report setup? can you approach the individual pls? i need help

 

_____

 

or can you post your newer version of those code above?

v-chenwuz-msft
Community Support
Community Support

Hi @ejuang,

 

What is the content of the error details. Please make sure you register your application correctly and get the token.

Embed content in your Power BI embedded analytics application - Power BI | Microsoft Docs

Maybe this link will be helpful to you.

Power BI (Embed dashboard with Vue.js and Power BI REST API using Postman). Part 4 (Embed with Vue.j...

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the reply! I think I have the application registered correctly, as I am receiving a token and embed url from Power BI. However, the embedded application appears to throw an error while rendering the report/graphics.

Anonymous
Not applicable

Hi,

I am facing a similar issue. Were you able to find any solution?

Thanks

Garima Singh

For us this turned out to be an issue with the way the report in PowerBI was configured...I don't remember the specifics but it had nothing to do with the PowerBI to Salesforce integration in this case.

Hello, @ejuang , would you be able to get specifics from your Power BI administrator as to the solution to this error? As this is a community for Microsoft product users, it would be tremendously helpful to provide specific here. And...it could help solve the same issue that I am encountering 🙂 Thank you!

Hi.
I got some related issue. Does anybody have updated solutions related to this?

Thank you

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors