Forum Discussion
Underlying error message:Value cannot be null. Parameter name: uriString
- 7 years ago
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.
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
// 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") }
];
- rcyber7 years agoResolver I
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!
- rcyber7 years agoResolver I
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.