PowerBI Embedded报告在由Javascript API呈现时挂起

问题描述 投票:0回答:1

我正在尝试将PowerBI报告嵌入到我的网络应用程序中,该应用程序使用Javascript API在我的开发服务器中本地运行。我知道一切正常,因为我在他们的Playground中成功地呈现了所需的报告,因此它不会成为嵌入式服务器或Azure的问题。在我的控制台窗口中,有多个警告和相同原始策略阻止的外部资源错误,以及可能与我无法解密的PBI Javascript API相关的uncaught exception: [object Object]错误。该报告只会永久加载,显示动画的PowerBI徽标。在尝试在本地嵌入报告时是否有其他人遇到此问题?这是负责渲染的代码:

var embedContainer = $("#container");
var models = window.['powerbi-client'].models;

    var config= {
        type: 'report',
        tokenType: models.TokenType.Embed,
        accessToken: ginormous embed token,
        embedUrl: https://app.powerbi.com/reportEmbed?reportId=ommited_for_privacy&groupId=ommited_for_privacy,
        id: the_report_id,
        permissions: models.Permissions.All,
        settings: {
                filterPaneEnabled: true,
                navContentPaneEnabled: true
        }
    };

    // Embed the report and display it within the div container.
    var report = powerbi.embed(embedContainer.get(0), config);

    // Report.off removes a given event handler if it exists.
    report.off("loaded");

    // Report.on will add an event handler which prints to Log window.
    report.on("loaded", function() {
        Log.logText("Loaded");
    });

    report.on("error", function(event) {
        Log.log(event.detail);

        report.off("error");
    });

    report.off("saved");
    report.on("saved", function(event) {
        Log.log(event.detail);
        if(event.detail.saveAs) {
                Log.logText('In order to interact with the new report, create a new token and load the new report');
        }
    });

以下是所有控制台错误:

uncaught exception: [object Object]

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dc.services.visualstudio.com/v2/track. (Reason: CORS request did not succeed).

Source map error: request failed with status 404
Resource URL: http://localhost:3000/temp/scripts/App.js

Source Map URL: powerbi.js.map
Source map error: request failed with status 404
Resource URL: https://app.powerbi.com/13.0.5314.162/scripts/ai.0.js

Source Map URL: ai.0.js.map
Source map error: request failed with status 404
Resource URL: https://app.powerbi.com/13.0.5314.162/scripts/reportembed.externals.bundle.min.js

Source Map URL: interact.min.js.map
javascript powerbi-embedded
1个回答
0
投票

我的坏人

问题是Firefox没有显示异常的原因,但Chrome确实如此。在询问之前我应该​​在另一个浏览器中进行测试。使用异常文本,我可以在tokenType参数中将问题跟踪到拼写错误,并且它工作得很好。

© www.soinside.com 2019 - 2024. All rights reserved.