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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
huxi
New Member

powerbi-client npm v2.23.0 bug - "Invalid embed URL detected" due to incorrect regex

Hi,

 

there seems to be a bug introduced in the latest version of the powerbi-client package, v2.23.0. There is a new check introduced to validate the embedUrl parameter, however the regex that is used is incorrect. The check performed by 'validateEmbedUrl' has this conditional: 'allowedPowerBiHostsRegex.test(url.hostname)', 'allowedPowerBiHostsRegex' being defined as a regex with the global flag. The problem is that global regex in js have state as described here, and the regex basically alters between true and false values causing the widget to work only every second time it is loaded. The github page seems to be outdated and there is no way to raise a PR / bug against the latest codebase, what is the proper way of getting this fixed? The fix would simply be to remove the global flag from the regex (there is also another regex in the new version that suffers from this).

 

Thanks,

 

David

 

ps. here is a debug session that showcases that the same expression yields altering results:

huxi_0-1711613535540.png

 

5 REPLIES 5
jitinpurwal
New Member

I am getting the same issue while using power bi-client npm v3.0.5. on the second click it's not working. it throws an error alternatively. 

jitinpurwal_0-1711722341762.png

 

 

 

mahartov
Microsoft Employee
Microsoft Employee

Thank you for reaching out and reproting this issue, we will release a new SDK vesrion soon with a fix. I will update this thread once the release is completed.

I am using powerbi-client npm v3.0.5, For Power BI report, I am not getting this error. But for embedded paginated reports getting this "Invalid embed URL".
Is it some thing like fixed for Power BI Report and still open for pagiated reports?
Its not working in the first click, then works in second click and in third click its again not working.

Sabarivel_0-1711966425197.png

 

 

 

 

Please upgrade to version 2.23.1, issue should be resolved with this version

i was facing the same issued as reported above.

The new version solved it for me !

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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