powerbi-client-react: Seeing error "Embed URL is invalid for this scenario" when trying to loan any report in the embed component

We are trying to embed a report in our react app but are consistently getting blocked by this error “Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL”. It doesn’t seem to matter how we modify the URL, it won’t load no matter what. When I remove the autoAuth QSP then it just shows a loading indicator forever.

I got the URL by going to the PowerBI report and selecting the Embed option and pasting that URL into my code. image

We already had code that was working with this report a few months back on this same package version but we had put it on the shelf and now when we came back it no longer is working despite not making any changes to it on our side. This leads me to believe it might be some kind of service side change that is causing the issue but if someone has other ideas on how to troubleshoot or things to try I would be open to any suggestions.

Embed snippet

import { PowerBIEmbed } from 'powerbi-client-react';

const reportUrl = 'https://<tenantDomain>.powerbi.com/reportEmbed?reportId=<reportId>&autoAuth=true&ctid=<tenantId>';
return (
    <div className={classNames.root}>
        <PowerBIEmbed
            embedConfig={{
                type: 'report',
                embedUrl: reportUrl,
            }}
        />
    </div>
);

Stats: Package version 1.3.5 (also tested with 1.4.0)

Screenshot image

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

This problem occurs in powerbi-client@2.23.0 and can be mitigated by installing powerbi-client@2.22.4.

More: powerbi-client@2.23.0 has an allowedPowerBiHostsRegex regex that uses the g flag, which causes it to remember where the last successful match was, and therefore sometimes returns true and sometimes false.

The issue has been fixed with the new version release of powerbi-client v2.23.1 .

Install the latest version and let us know if you still face the same issue.

I had a different error message (Invalid embed URL detected. Either URL hostname or protocol are invalid. Please use Power BI REST APIs to get the valid URL), though looks like the same underlying issue. Confirming v2.23.1 fixed it for me as well. Thanks!

I had same issue. Thanks for v.2.23.1 It worked for me too.

The issue has been fixed with the new version release of powerbi-client v2.23.1 .

Install the latest version and let us know if you still face the same issue.

2.23.1 worked for me too thanks!

The issue has been fixed with the new version release of powerbi-client v2.23.1 .

Install the latest version and let us know if you still face the same issue.

It works for me! thx!