Forum Discussion

Nexxo's avatar
Nexxo
Frequent Visitor
4 years ago
Solved

Server Error ReferenceError: window is not defined

Hi, I'm developing an application in next.js (typescript) that uses powerbi-client-react to render powerbi dashboards in the application. In a simple react application I can do what I want but would...
  • Anonymous's avatar
    Anonymous
    4 years ago

    HI Nexxo,

    I'd like to suggest you take a look at the following link that includes usage sample with power bi embedded content and 'nextjs' if it helps:
    nextjs-powerbi - npm (npmjs.com)

    Spoiler
    import React, { Component } from "react";
    import PowerbiEmbedded from "nextjs-powerbi";
    
    class App extends Component {
      render() {
        return (
          <div className="App">
            <PowerbiEmbedded
              id={`${YOUR_REPORT_ID}`} // required
              embedUrl={`${YOUR_EMBED_URL}`} // required
              accessToken={`${YOUR_EMBED_TOKEN}`} // required
              filterPaneEnabled={false}
              navContentPaneEnabled={false}
              pageName={`${YOUR_PAGE_ID}`}
              embedType={`${EMBED_TYPE}`}
              tokenType={`${TOKEN_TYPE}`}
              permissions={`${PERMISSIONS}`}
              settings={
                {
                  // any settings including localeSettings
                }
              }
              width="600px"
              height="900px"
            />
          </div>
        );
      }
    }
    
    export default App;

    Regards,

    Xiaoxin Sheng