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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
alchen00
Helper I
Helper I

PowerBi-Client NPM v2.22.2 -- ReferenceError: window is not defined (for Wix Integration)

I am trying to embed a Power Bi report in Wix with the following conditions:
1) Embed for Organization (User owns Data)
2) Able to get Azure Token (TokenType.Aad)
3) Able to get Report when calling Power Bi REST API (response 200)

In my Wix code, when I added :

import * as powerbi from 'powerbi-client';

 

I get an error of  ReferenceError: window is not defined.  Since Wix velo code is a subset version of JavaScript, I gather that wix does not have "window", which is required in PowerBi-Client NPM v2.22.2.   

My question is: 
1) Is there any other way to import PowerBi-Client NPM, but will not require window?
2) Or, is there any otherway I can other way I call powerbi.embed(reportContainer, config)? 
- I replicated every step in the link below except unable to do the last Step5 to embed the report and display it in a container.    
https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-organization-app 

alchen00_1-1697512841951.png

I also understand that there is a react version to PowerBi-Client.  I was told that (i) react version of PowerBi-client does not use "window", and (ii) wix can write react to some degree.  However, as of this moment, this NPM is not yet available on Wix platform.  Thus, unable to try it.   

1 ACCEPTED SOLUTION
alchen00
Helper I
Helper I

For all the Wix and Power Bi users out there, refer to this post for the solution.
https://forum.wixstudio.com/t/powerbi-client-npm-v2-22-2-referenceerror-window-is-not-defined-for-wi...   

View solution in original post

1 REPLY 1
alchen00
Helper I
Helper I

For all the Wix and Power Bi users out there, refer to this post for the solution.
https://forum.wixstudio.com/t/powerbi-client-npm-v2-22-2-referenceerror-window-is-not-defined-for-wi...   

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors