Forum Discussion

shvitani's avatar
shvitani
Frequent Visitor
5 years ago

Processing error: The underlying connection was closed: An unexpected error occurred on a receive.

We keep getting this error (not always, but most at the time) on refresh, but only on Power BI Service (we have no problem from Power BI Desktop) - Please help...

 

Error details:

Hide On demand 4.1.2021 20.49.11 4.1.2021 20.54.22 Failed There was an error when processing the data in the dataset.
Processing error: The underlying connection was closed: An unexpected error occurred on a receive.
Cluster URI: WABI-WEST-EUROPE-B-PRIMARY-redirect.analysis.windows.net
Activity ID: 2d80e61f-48a2-4541-a176-1217d24cc91a
Request ID: 43eafda7-cfe0-01e2-bb3a-9f2781e6d703
Time: 2021-01-04 19:54:22Z

 

UPDATE AND MORE DETAILS:

We are requesting our own web API using these two functions:

 

GetAuthentication()

 

() => 
let
    output = Json.Document( 
        Web.Contents(
            #"www adresse",
            [   
                RelativePath ="/OmegaAPITest/Authentication/Token",
                Headers=[Accept="application/json", #"Content-Type"="application/x-www-form-urlencoded;charset=UTF-8"], 
                Content=Text.ToBinary("grant_type=password&username="&#"Brugernavn"&"&password="&Adgangskode&"&client_id=2E54A038A9E598FD325F592EBA63EAD12210DC815907D4022210DC815907D502")
                //Query=[r=Number.ToText(Number.Random())],
            ]
        )
    )
in  
    output

 

 

GetRequest(...)

 

(request as text) => 
let
    authentication = GetAuthentication(),
    output = Json.Document(   
        Web.Contents(
            #"www adresse", 
            [
                RelativePath = "/OmegaAPITest/v2/" & request,
                Timeout=#duration(0,1,0,0), //#duration(days as number, hours as number, minutes as number, seconds as number) as duration
                Headers=[#"Authorization"= "Guid " & authentication[access_token], #"Content-Type"="application/json; charset=utf-8"]
            ]
        )
    )
 in      
    output

 

 

PostRequest(...)

 

(request as text, content as text) => 
let  
    authentication = GetAuthentication(),
    output = Json.Document(
        Web.Contents(
            #"www adresse", 
            [
                RelativePath = "/OmegaAPITest/v2/" & request,
                Timeout=#duration(0,1,0,0), //#duration(days as number, hours as number, minutes as number, seconds as number) as duration
                Headers=[#"Authorization"= "Guid " & authentication[access_token], #"Content-Type"="application/json; charset=utf-8"],
                Content=Text.ToBinary(content)
            ]
        )
    )
in  
    output

 

 
We have extend our API to be able to cache the response for large data calculation - all this to overcome the problem.
Refreshing data on desktop alway work, but not then we publish it on the service and try refresh using the service.

For now it seems to work hvis API have caches some data for faster response, but only stabil if we add som delays - see new functions below:

 

GetRequestWithDelay(...)

 

(request as text, delay as number) => 
let
    output = Function.InvokeAfter(() =>
    let
        authentication = GetAuthentication(),
        response = Json.Document(   
            Web.Contents(
                #"www adresse", 
                [
                    RelativePath = "/OmegaAPITest/v2/" & request,
                    Timeout=#duration(0,1,0,0), //#duration(days as number, hours as number, minutes as number, seconds as number) as duration
                    Headers=[#"Authorization"= "Guid " & authentication[access_token], #"Content-Type"="application/json; charset=utf-8"]
                ]
            )
        )
    in 
        response, #duration(0,0,0,delay))
 in      
    output

 

 

PostRequestWithDelay(...)

 

(request as text, content as text, delay as number) => 
let
    output = Function.InvokeAfter(()=>
    let
        authentication = GetAuthentication2(),
        response = Json.Document(
                Web.Contents(
                    #"www adresse", 
                    [
                        RelativePath = "/OmegaAPITest/v2/" & request,
                        Timeout=#duration(0,1,0,0), //#duration(days as number, hours as number, minutes as number, seconds as number) as duration
                        Headers=[#"Authorization"= "Guid " & authentication[access_token], #"Content-Type"="application/json; charset=utf-8"],
                        Content=Text.ToBinary(content)
                    ]
                )
            )
    in 
        response,  #duration(0,0,0,delay))
in  
    output

 

 

6 Replies

    • shvitani's avatar
      shvitani
      Frequent Visitor

      Hi Amine,

       

      Our report use Power Query to get data using our own public API. The report don't use gateway...

    • shvitani's avatar
      shvitani
      Frequent Visitor

      Hi Jay,

       

      Thanks for your reply, I have almost tried everything related to the transport layer security (TLS), nothing helped - please note that it's not on every refresh it crash, but most of the time.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi shvitani ,

         

        If this situation happens completely randomly, it will be difficult to debug the issue.

        You could try to open a support ticket. It is free if you have a Pro account.

        Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".

         

        Best Regards,

        Jay