Forum Discussion

danielmccluskey's avatar
danielmccluskey
Regular Visitor
2 years ago
Solved

Something went wrong, Dataflow publish failed

Hi, Im getting a strange and vague error when I publish my data flow gen 2. All I get is "Something went wrong" and can't seem to find out anything else about where it is going wrong.   I can pu...
  • danielmccluskey's avatar
    2 years ago

    I managed to solve this, I was changing the base URL of the Web.Contents which meant the flow didn't know what connector to use everytime it changed.

     

    Fixed by using one Base URL and then using RelativePath and Query properly.

     

    So I changed this

     

    let
        FetchPage = (url) =>
            let
                Source = Json.Document(Web.Contents(url)),
                Data = Source[data],
                NextPage = Source[meta][pagination][next],
                More = Source[meta][pagination][more],
                Result = if More then Data & @FetchPage(NextPage) else Data
            in
                Result,
        StartURL = "https://api.wonde.com/v1.0/schools?page=1",
        AllData = FetchPage(StartURL),
    
    ...and so on with some more data changes

     

    into this:

     

    FetchPage = (url) =>
            let
                baseURL = "https://api.wonde.com/v1.0/",
                relativePath = "schools",
                queryList = Uri.Parts(url)[Query],
                response = Web.Contents(baseURL,
                [
                    RelativePath = relativePath,
                    Query = queryList
                ]),
                Source = Json.Document(response),
                Data = Source[data],
                NextPage = Source[meta][pagination][next],
                More = Source[meta][pagination][more],
                Result = if More then Data & @FetchPage(NextPage) else Data
            in
                Result,
        StartURL = "https://api.wonde.com/v1.0/schools?page=1",
        AllData = FetchPage(StartURL),

    which means it always uses the same connector and is using the relative path correctly.