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
rcyber
Resolver I
Resolver I

Underlying error message:Value cannot be null. Parameter name: uriString

Hello all!

 

I've developed a custom connector. It is very simple and just shows the 'Hello world!' message.

Also I added an OAuth authentification method. And it works fine too in Power BI desktop but not on Power BI Service.

When I'm trying to add a datasource on Power BI service I get the following error: "Google:There was an error in the data gateway. Underlying error message:Value cannot be null. Parameter name: uriString".

What does it mean? What do I wrong?

 

2019-03-04_11-00-02.png

 

Thanks in advance,

Alexander.

1 ACCEPTED SOLUTION

I've found out MS has issued the new version of Gateway.

I've installed that and my issue is disappeared then.

So, my connector works fine now and we can close the topic.

 

Thanks.

View solution in original post

5 REPLIES 5
Kyle-MSFT
Microsoft Employee
Microsoft Employee

Another thing to check if you are getting the "Value cannot be null. Parameter name: uriString" error while creating a gateway connection to a custom data connector. Verify you are using the correct redirect endpoint/URL in your gateway's OAuth flow. It needs to be https://oauth.powerbi.com/views/oauthredirect.html. You can read more information about the redirect URL here in the "OAuth and Power BI" section: https://docs.microsoft.com/en-us/power-query/samples/github/readme 

Anonymous
Not applicable

Hi @rcyber ,

 

Did you enable custom connector options on gateway to allow it handle correspond refresh requests?

Use custom data connectors with the On-premises data gateway

 

In addition, please double check your datasource url to confirm you can access this datasource from internet.

 

Regards,

Xiaoxin Sheng

Thanks for reply.

 

I've checked everything ten times. Still not working.

In order to understanding what is wrong I created a new PQConnector project and added the code from GitHub sample that is placed here. I added the functions for implementation of OAuth process.

 

It works fine under Visual Studio and Power BI Desktop both.

But if I add this connector onto Power BI Service I have got the same error.

I guess I've missed some URL I need in to complete OAuth but what have I missed? And why does it work in Power BI desktop but not on Power BI service then?

 

Will be appreciate for any help.

Below is the code of the test connector.

 

Thanks,

Alexander

Spoiler
// This file contains your Data Connector logic
section GitHub;

redirect_uri = "https://oauth.powerbi.com/views/oauthredirect.html";
client_id = "";
client_secret = "";
windowWidth = 1000;
windowHeight = 800;


[DataSource.Kind="GitHub", Publish="GitHub.Publish"]
shared GitHub.Contents = (optional message as text) =>
    let
        _message = if (message <> null) then message else "(no message)",
        a = "Hello from GitHub: " & _message
    in
        a;

// Data Source Kind description
GitHub = [
    Authentication = [
        OAuth = [
            StartLogin = StartLogin,
            FinishLogin = FinishLogin
        ]
    ],
    Label = Extension.LoadString("DataSourceLabel")
];

StartLogin = (resourceUrl, state, display) =>
        let
            TestConnection = (url) => {"GitHub.Contents"},
            AuthorizeUrl = "https://Github.com/login/oauth/authorize?" & Uri.BuildQueryString([
                client_id = client_id,
                scope = "user, repo",
                state = state,
                redirect_uri = redirect_uri])
        in
            [
                LoginUri = AuthorizeUrl,
                CallbackUri = redirect_uri,
                WindowHeight = windowHeight,
                WindowWidth = windowWidth,
                Context = null
            ];

FinishLogin = (context, callbackUri, state) =>
    let
        Parts = Uri.Parts(callbackUri)[Query]
    in
        TokenMethod(Parts[code]);

 TokenMethod = (code) =>
    let
        Response = Web.Contents("https://Github.com/login/oauth/access_token", [
            Content = Text.ToBinary(Uri.BuildQueryString([
                client_id = client_id,
                client_secret = client_secret,
                code = code,
                redirect_uri = redirect_uri])),
            Headers=[#"Content-type" = "application/x-www-form-urlencoded",#"Accept" = "application/json"]]),
        Parts = Json.Document(Response)
    in
        Parts;

// Data Source UI publishing description
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") }
];

 

Also I've tried the following.

 

I put whole code from sample into Github.pq and it does not work.

Something is wrong but I can't understand what.

 

Help!

I've found out MS has issued the new version of Gateway.

I've installed that and my issue is disappeared then.

So, my connector works fine now and we can close the topic.

 

Thanks.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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