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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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 

v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors