<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Server Error ReferenceError: window is not defined in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Server-Error-ReferenceError-window-is-not-defined/m-p/2257220#M33631</link>
    <description>&lt;P&gt;Hi, I'm developing an application in next.js (typescript) that uses powerbi-client-react to render powerbi dashboards in the application.&lt;/P&gt;&lt;P&gt;In a simple react application I can do what I want but would like to do it in next.js.&lt;/P&gt;&lt;P&gt;Here's the error and code:&lt;/P&gt;&lt;P&gt;Server Error ReferenceError: window is not defined This error happened while generating the page. Any console logs will be displayed in the terminal window. Call Stack new WindowPostMessageProxy file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (5959:56) wpmpFactory file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (8252:12) new Service file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (10554:21) Object../src/powerbi-client.ts file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (8858:15) __webpack_require__ file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (33:30) &amp;lt;unknown&amp;gt; file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (97:18) &amp;lt;unknown&amp;gt; file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (100:10) webpackUniversalModuleDefinition file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (6:20) Object.&amp;lt;anonymous&amp;gt; file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (13:3) Module._compile node:internal/modules/cjs/loader (1101:14) import type { NextPage } from 'next' import React, { useState} from 'react' import Head from '../components/head' import dynamic from 'next/dynamic' import { EmbedProps } from 'powerbi-client-react'; import { models } from "powerbi-client"; const PowerBIEmbed = dynamic&amp;lt;EmbedProps&amp;gt;(() =&amp;gt; import('powerbi-client-react').then(m =&amp;gt; m.PowerBIEmbed), { ssr: false }); const Home: NextPage = () =&amp;gt; { const reportId = process.env.REACT_APP_REPORT_ID; const accessToken = process.env.REACT_APP_ACCESS_TOKEN; const embedUrl = `&lt;A href="https://app.powerbi.com/reportEmbed?reportId=${reportId}&amp;amp;groupId=${groupId" target="_blank"&gt;https://app.powerbi.com/reportEmbed?reportId=${reportId}&amp;amp;groupId=${groupId&lt;/A&gt;]` const [config] = useState&amp;lt;models.IReportEmbedConfiguration&amp;gt;({ type: 'report', embedUrl: embedUrl, tokenType: models.TokenType.Aad, accessToken: accessToken, settings: { panes: { filters: { expanded: false, visible: false } }, filterPaneEnabled: false, navContentPaneEnabled: false, zoomLevel: 1, background: 1, customLayout: { displayOption: models.DisplayOption.FitToWidth } } }); return ( &amp;lt;div&amp;gt; &amp;lt;Head/&amp;gt; &amp;lt;main&amp;gt; &amp;lt;div&amp;gt; &amp;lt;PowerBIEmbed embedConfig = { config } cssClassName = { "report-style-class vh-100"} /&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/main&amp;gt; &amp;lt;/div&amp;gt; ) } export default Home&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jan 2022 10:33:54 GMT</pubDate>
    <dc:creator>Nexxo</dc:creator>
    <dc:date>2022-01-07T10:33:54Z</dc:date>
    <item>
      <title>Server Error ReferenceError: window is not defined</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Server-Error-ReferenceError-window-is-not-defined/m-p/2257220#M33631</link>
      <description>&lt;P&gt;Hi, I'm developing an application in next.js (typescript) that uses powerbi-client-react to render powerbi dashboards in the application.&lt;/P&gt;&lt;P&gt;In a simple react application I can do what I want but would like to do it in next.js.&lt;/P&gt;&lt;P&gt;Here's the error and code:&lt;/P&gt;&lt;P&gt;Server Error ReferenceError: window is not defined This error happened while generating the page. Any console logs will be displayed in the terminal window. Call Stack new WindowPostMessageProxy file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (5959:56) wpmpFactory file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (8252:12) new Service file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (10554:21) Object../src/powerbi-client.ts file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (8858:15) __webpack_require__ file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (33:30) &amp;lt;unknown&amp;gt; file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (97:18) &amp;lt;unknown&amp;gt; file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (100:10) webpackUniversalModuleDefinition file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (6:20) Object.&amp;lt;anonymous&amp;gt; file:///C:/Users/user/coding/project/node_modules/powerbi-client/dist/powerbi.js (13:3) Module._compile node:internal/modules/cjs/loader (1101:14) import type { NextPage } from 'next' import React, { useState} from 'react' import Head from '../components/head' import dynamic from 'next/dynamic' import { EmbedProps } from 'powerbi-client-react'; import { models } from "powerbi-client"; const PowerBIEmbed = dynamic&amp;lt;EmbedProps&amp;gt;(() =&amp;gt; import('powerbi-client-react').then(m =&amp;gt; m.PowerBIEmbed), { ssr: false }); const Home: NextPage = () =&amp;gt; { const reportId = process.env.REACT_APP_REPORT_ID; const accessToken = process.env.REACT_APP_ACCESS_TOKEN; const embedUrl = `&lt;A href="https://app.powerbi.com/reportEmbed?reportId=${reportId}&amp;amp;groupId=${groupId" target="_blank"&gt;https://app.powerbi.com/reportEmbed?reportId=${reportId}&amp;amp;groupId=${groupId&lt;/A&gt;]` const [config] = useState&amp;lt;models.IReportEmbedConfiguration&amp;gt;({ type: 'report', embedUrl: embedUrl, tokenType: models.TokenType.Aad, accessToken: accessToken, settings: { panes: { filters: { expanded: false, visible: false } }, filterPaneEnabled: false, navContentPaneEnabled: false, zoomLevel: 1, background: 1, customLayout: { displayOption: models.DisplayOption.FitToWidth } } }); return ( &amp;lt;div&amp;gt; &amp;lt;Head/&amp;gt; &amp;lt;main&amp;gt; &amp;lt;div&amp;gt; &amp;lt;PowerBIEmbed embedConfig = { config } cssClassName = { "report-style-class vh-100"} /&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/main&amp;gt; &amp;lt;/div&amp;gt; ) } export default Home&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 10:33:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Server-Error-ReferenceError-window-is-not-defined/m-p/2257220#M33631</guid>
      <dc:creator>Nexxo</dc:creator>
      <dc:date>2022-01-07T10:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Server Error ReferenceError: window is not defined</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Server-Error-ReferenceError-window-is-not-defined/m-p/2260294#M33659</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/347022"&gt;@Nexxo&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;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:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://www.npmjs.com/package/nextjs-powerbi" target="_blank" rel="noopener"&gt;nextjs-powerbi - npm (npmjs.com)&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-SPOILER&gt;&lt;LI-CODE lang="javascript"&gt;import React, { Component } from "react";
import PowerbiEmbedded from "nextjs-powerbi";

class App extends Component {
  render() {
    return (
      &amp;lt;div className="App"&amp;gt;
        &amp;lt;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"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}

export default App;&lt;/LI-CODE&gt;&lt;/LI-SPOILER&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 06:53:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Server-Error-ReferenceError-window-is-not-defined/m-p/2260294#M33659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-04T06:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Server Error ReferenceError: window is not defined</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Server-Error-ReferenceError-window-is-not-defined/m-p/3457302#M44784</link>
      <description>&lt;P&gt;could you help me to navigate between the report pages by using this code&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 08:48:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Server-Error-ReferenceError-window-is-not-defined/m-p/3457302#M44784</guid>
      <dc:creator>Sanjeevan</dc:creator>
      <dc:date>2023-10-03T08:48:03Z</dc:date>
    </item>
  </channel>
</rss>

