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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jaryszek
Impactful Individual
Impactful Individual

Custom connector You can't schedule refresh for this semantic model because the following data sourc

Hello,

i created custom connector to github:

[DataSource.Kind="GitHub", Publish="GitHub.Publish"]
shared GitHub.Contents = (repositoryName as text, optional folderPath as text) =>
    let
        baseUrl = "https://api.github.com/",
        url = "repos/xxx/" & repositoryName & "/contents/" & folderPath,
        source = Json.Document(Web.Contents(baseUrl, [
            RelativePath = url,
            Headers = [
                #"Authorization" = "Bearer " & Extension.CurrentCredential()[access_token],
                #"User-Agent" = "PowerQuery"
            ]
        ]))
    in
        source;

GitHub = [
    Authentication = [
        OAuth = [
            StartLogin = (resourceUrl, state, display) =>
                let
                    authorizeUrl = "https://github.com/login/oauth/authorize?" &
                        "client_id=" & client_id &
                        "&redirect_uri=https://oauth.powerbi.com/views/oauthredirect.html" &
                        "&scope=repo" &
                        "&state=" & state
                in
                    [
                        LoginUri = authorizeUrl,
                        CallbackUri = "https://oauth.powerbi.com/views/oauthredirect.html",
                        WindowHeight = 720,
                        WindowWidth = 1024,
                        Context = null
                    ],

            FinishLogin = (context, callbackUri, state) =>
                let
                    parts = Uri.Parts(callbackUri)[Query],
                    code = parts[code],
                    access_token_response = Json.Document(Web.Contents("https://github.com/login/oauth/access_token", [
                        Content = Text.ToBinary("client_id=" & client_id & "&client_secret=" & client_secret & "&code=" & code),
                        Headers = [
                            #"Content-Type" = "application/x-www-form-urlencoded",
                            Accept = "application/json"
                        ]
                    ])),
                    access_token = access_token_response[access_token]
                in
                    [
                        access_token = access_token
                    ],

            Refresh = (resourceUrl, refresh_token) => error "GitHub does not support refresh tokens.",
            TestConnection = (access_token_record) => {"https://api.github.com/user"},
            AccessToken = (access_token_record) => "Bearer " & access_token_record[access_token]
        ]
    ]
];

GitHub.Publish = [
    Beta = true,
    Category = "Other",
    ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
    LearnMoreUrl = "https://powerbi.microsoft.com/",
    SourceImage = GitHub.Icons,
    SourceTypeImage = GitHub.Icons
];

GitHub.Icons = [
    Icon16 = { Extension.Contents("GitHub16.png"), Extension.Contents("GitHub20.png"), Extension.Contents("GitHub24.png"), Extension.Contents("GitHub32.png") },
    Icon32 = { Extension.Contents("GitHub32.png"), Extension.Contents("GitHub40.png"), Extension.Contents("GitHub48.png"), Extension.Contents("GitHub64.png") }
];

 

and got in pwoer bi service: 

"You can't schedule refresh for this semantic model because the following data sources currently don't support refresh"

i used relative path in first function, what i am missing?

Sources how to fix it applied from here:
https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-i... 
https://www.youtube.com/watch?v=fstsQMZiHME 

Best,
Jacek

1 ACCEPTED SOLUTION

Hi @jaryszek ,

Thanks for the update and the video reference!
The setup in the video works fine in Power BI Desktop, but the Service is a bit stricter when it comes to scheduled refresh. It expects the base URL to be static and predictable. To get around this, try updating your connector so that the baseUrl is fixed:
https://api.github.com/repos/octocat/ 

Just replace octocat with your GitHub username or org. Then you can build the rest of the path using RelativePath like below:
RelativePath = repositoryName & "/contents/" & folderPath.

Also,double check that your privacy level is set to Public or Organizational, and take a look at the refresh history in case it gives more clues.

If this resolves your query,consider accept it as solution.

Regards,
Pallavi.

View solution in original post

3 REPLIES 3
v-pagayam-msft
Community Support
Community Support

Hi @jaryszek ,
Thank you for reaching out to us on Microsoft Fabric Community Forum!

The issue likely comes from using dynamic values like repositoryName and folderPath directly in the URL, which makes the path non-static. Power BI needs the path to be predictable at design time. Also, make sure you have added a TestConnection function at the top level of your connector , and ideally keep the base URL static while passing variables as query parameters instead. 
Please refer the documents here:
https://learn.microsoft.com/en-us/power-query/handling-authentication#using-webcontents
https://learn.microsoft.com/en-us/powerquery-m/web-contents

If this solution meets your requirement,consider marking it as solution.

Regards,
Pallavi.

Thanks i have test connection function added.

https://www.youtube.com/watch?v=fstsQMZiHME regarding this video path is not entirely static...

Hi @jaryszek ,

Thanks for the update and the video reference!
The setup in the video works fine in Power BI Desktop, but the Service is a bit stricter when it comes to scheduled refresh. It expects the base URL to be static and predictable. To get around this, try updating your connector so that the baseUrl is fixed:
https://api.github.com/repos/octocat/ 

Just replace octocat with your GitHub username or org. Then you can build the rest of the path using RelativePath like below:
RelativePath = repositoryName & "/contents/" & folderPath.

Also,double check that your privacy level is set to Public or Organizational, and take a look at the refresh history in case it gives more clues.

If this resolves your query,consider accept it as solution.

Regards,
Pallavi.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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