Forum Discussion

threw001's avatar
threw001
Helper III
1 year ago

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

Hi,

 

I changed my device and i am getting the below error:

DataSource.Error: The underlying connection was closed: An unexpected error occurred on a receive. power query

 

I am only getting these errors on 2 queries. These queries are pulling data from:

http://worldtimeapi.org/api/

 

All other queries are fine which are pulling data from OneDrive

 

Please advise

1 Reply

  • Hi threw001 

    The connection to this API is public, so it should be set to Anonymous in Power BI.
    If you are receiving the error:
    DataSource.Error: The underlying connection was closed: An unexpected error occurred on a receive

    Try the following steps:

    1. Verify API Availability
    Open http://worldtimeapi.org/api/ in your browser to confirm it is accessible.
    If not, the issue might be with the API or your device/network settings.

    2. Switch to HTTPS
    Update the URL to https://worldtimeapi.org/api/ instead of http.
    Some networks or devices block HTTP traffic.

    3. Set Anonymous Access

    Go to Power BI > File > Options and settings > Data Source Settings.
    Locate the API connection and click Edit Permissions.
    Set the authentication method to Anonymous and save.
    Verify Query in Advanced Editor
    4. Ensure the M code is correct:

    let
    Source = Json.Document(Web.Contents("http://worldtimeapi.org/api/"))
    in
    Source
    5. Check Network Configuration
    6.Ensure no firewall or antivirus is blocking the connection.

    If none of these steps resolve the issue, the problem is outside of Power BI and likely related to the API itself.
    In this case, it is recommended to contact the website’s support team for assistance.

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.