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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jberkers
Frequent Visitor

PSA: Solution to "Something went wrong" when publishing Data Flow Gen2 or scheduling PBI Refresh

Hi All,

 

I'm a relatively new user to PowerBI and Fabric, and have been thrown in the deep end trying to make sense of this for my organisation. One of the things that I have come across that I found no specific/direct guidance on achieving a working outcome is one of the causes for the above generic error: "Something went wrong" when publishing a Microsoft Fabric DataFlow Gen2.

 

I'm not saying this solves all of the errors, but this should, at least solve some of them. I am posting this here because I had trouble finding a solution for my specific case, and have determined that this should also allow PowerBI Scheduled Refresh to work also.

 

The crux of my issue was that I needed to get data from a Web API data source, but as soon as I tried to be fancy by using a Parameter for the base URL and computed the actual request URL to use with Web.Content, the Data Flow failed to publish.

 

After some research I worked out that it is caused by the Data Flow validator not being able to determine which "Connection" to use because there is a calculation on the URL parameter passed to Web.Content. As an example, the following code will cause this error:

 

let
  baseURL = "https://api.service.com/api/v2",
  relativePath = "/endpoint1",
  URL = Text.Combine ({baseURL, relativePath}),

  records = Json.Document(Web.Contents(url))
in
  records

 

I know this is a simple example, but I'm trying to get the point accross.

 

Similarly, if you need to pass a query (like a page number, or a documents per page parameter) in the URL, and add that to the Text.Combine call, you run into the same issue.

 

The way I found that can make such a requirement work in a Data Flow Gen2 or Scheduled Refresh is to use the extended capabilities of the Web.Contents function, like so:

 

let
  baseURL = "https://api.service.com/api/v2",
  relativePath = "/endpoint1",
  currentPage = 1,
  pageSize = 100,

  response = Web.Contents (baseURL,
  [
    RelativePath = relativePath,
    Query = [ per_page = Text.From(pageSize), page = Text.From(currentPage)]
  ]),
  records = Json.Document (Response)
in
  records

 

Calling Web.Contents in this way allows the validator to confirm which connection to use, as well as programmatically changing the specific relative path that needs to be queried. You can paginate the output as well as get data for specific endpoints.

 

Finally, using this mechanism, the baseURL can be set as a parameter, allowing multiple M's to use the same data.

 

There are some additional capabilities of the Web.Contents function that you might also find handy.

 

Hopefully others find this useful as well.

 

Regards,

JohnB

0 REPLIES 0

Helpful resources

Announcements
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors