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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors