Forum Discussion

Gravity's avatar
Gravity
Regular Visitor
4 months ago
Solved

web content fetching error The exception was raised by the IDbCommand interface.

Error Derails:

Failure details: The last refresh attempt failed because of an internal service error. This is usually a transient issue. If you try again later and still see this message, contact support.

<ccon>The credentials provided for the Web source are invalid. (Source at https://app.desklog.io/api/v2/attendance_report.)</ccon>. The exception was raised by the IDbCommand interface.

How it was created:

Created a data source using access web content type (Anonymous).

passed the key and details using the Power Query Advanced Editor.

 

It was all working fine and one day suddenly stopeed working the the above message. nothing was changed. the credentials are still working when i use the postman.

Following is the Advanced editor code:

let
    // 1. Define your variables
    BaseUrl = "https://app.desklog.io",
    Token = "dsxxxxxxxxxxxxxG",
    CurrentDate = Date.ToText(Date.AddDays(Date.From(DateTime.LocalNow()), -1), "dd-MM-yyyy"),
    
    // 2. Use RelativePath and Query to keep the URL "Static" for the Service
    Source = Json.Document(Web.Contents(
        BaseUrl, 
        [
            RelativePath = "api/v2/attendance_report",
            Headers = [
                Authorization = "Bearer " & Token, // Or just Token depending on your API
                #"Content-Type" = "application/json"
            ],
            Query = [
                from_date = CurrentDate, // Reference your date parameters here
                to_date = CurrentDate
            ]
        ]
    )),
   // 3. DRILL DOWN into the "data" list immediately
    DataList = Source[data],

    // 4. Convert that specific list to a table
    #"Converted to Table" = Table.FromList(DataList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),

    // 5. Expand the records (this will give you your columns)
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"user_id", "employee_id", "name", "email", "team_name", "clock_in", "clock_out", "time_at_work", "productive_time", "focus_time", "idle_time", "offline_work_time", "over_time", "activity_percentage", "efficiency_percentage"}, {"user_id", "employee_id", "name", "email", "team_name", "clock_in", "clock_out", "time_at_work", "productive_time", "focus_time", "idle_time", "offline_work_time", "over_time", "activity_percentage", "efficiency_percentage"})
in
    #"Expanded Column1"
  • Hi,
    Since it was working earlier and the same token still works in Postman, I would not assume the token itself is definitely wrong. This looks more like a Power BI Service credential validation issue for the Web source.
    Your Power Query pattern is generally correct because you are using a static base URL with RelativePath and Query, which is the right approach for web/API refreshes in the Service. However, Power BI Service still validates credentials against the Web data source, and if the base URL or endpoint cannot be validated anonymously without the full headers/query parameters, it can throw this kind of “credentials provided for the Web source are invalid” error.
    A few things I would check:

    • In Power BI Service, go to the semantic model settings and re-enter the data source credentials.
    • Use Anonymous authentication because the token is being passed in the Authorization header.
    • If available, enable Skip test connection for this Web data source.
    • Remove and recreate the data source credentials if they are cached incorrectly.
    • Confirm whether the API expects Authorization = "Bearer " & Token or just the token value.
    • Replace Content-Type with Accept = "application/json" if this is a GET request, as Content-Type is normally more relevant when sending a request body.
    • Also check whether the token has expired, been rotated, or whether the API provider has changed anything such as IP restrictions, rate limits, required headers, or TLS/security rules.

    Regarding credentials working on Postman - This only proves the API/token is valid from Postman. It does not prove that Power BI Service can validate and refresh the same source successfully, because Power BI handles Web credentials, privacy levels, credential caching, and service-side validation differently. One more important point: if the token shown in your post is a real token, I would rotate it immediately and avoid hardcoding it directly in the query where possible.
    The key things I would try first are: reset the Web credentials in the Service, keep authentication as Anonymous, enable Skip test connection if available, and confirm the exact expected authorization header format.

     

    If my answer helped you solve the problem, please consider accepting it as the solution and help other members to use the same solution in same/similar situations.

     

    Thanks,
    Garvit Gupta
    Linkedin: https://www.linkedin.com/in/garvit-gupta/
  • Hi Gravity,

    Since you confirmed it worked, please mark the solution as accepted so it can help other community members.

     

    Thank you.

5 Replies

  • Hi,
    Since it was working earlier and the same token still works in Postman, I would not assume the token itself is definitely wrong. This looks more like a Power BI Service credential validation issue for the Web source.
    Your Power Query pattern is generally correct because you are using a static base URL with RelativePath and Query, which is the right approach for web/API refreshes in the Service. However, Power BI Service still validates credentials against the Web data source, and if the base URL or endpoint cannot be validated anonymously without the full headers/query parameters, it can throw this kind of “credentials provided for the Web source are invalid” error.
    A few things I would check:

    • In Power BI Service, go to the semantic model settings and re-enter the data source credentials.
    • Use Anonymous authentication because the token is being passed in the Authorization header.
    • If available, enable Skip test connection for this Web data source.
    • Remove and recreate the data source credentials if they are cached incorrectly.
    • Confirm whether the API expects Authorization = "Bearer " & Token or just the token value.
    • Replace Content-Type with Accept = "application/json" if this is a GET request, as Content-Type is normally more relevant when sending a request body.
    • Also check whether the token has expired, been rotated, or whether the API provider has changed anything such as IP restrictions, rate limits, required headers, or TLS/security rules.

    Regarding credentials working on Postman - This only proves the API/token is valid from Postman. It does not prove that Power BI Service can validate and refresh the same source successfully, because Power BI handles Web credentials, privacy levels, credential caching, and service-side validation differently. One more important point: if the token shown in your post is a real token, I would rotate it immediately and avoid hardcoding it directly in the query where possible.
    The key things I would try first are: reset the Web credentials in the Service, keep authentication as Anonymous, enable Skip test connection if available, and confirm the exact expected authorization header format.

     

    If my answer helped you solve the problem, please consider accepting it as the solution and help other members to use the same solution in same/similar situations.

     

    Thanks,
    Garvit Gupta
    Linkedin: https://www.linkedin.com/in/garvit-gupta/
  • Gravity's avatar
    Gravity
    Regular Visitor

    Thank you.
    Not sure whcih one of those worked. but it worked.

    • garvitgupta96's avatar
      garvitgupta96
      Icon for Resolver II rankResolver II

      That's great, If my answer helped you solve the problem, please consider accepting it as the solution and help other members to use the same solution in same/similar situations.

    • v-saisrao-msft's avatar
      v-saisrao-msft
      Icon for Community Support rankCommunity Support

      Hi Gravity,

      Since you confirmed it worked, please mark the solution as accepted so it can help other community members.

       

      Thank you.