Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Credentials are required" if "optional" is removed from parameter #334

Open
3 tasks done
dynamicapps opened this issue Jul 14, 2024 · 1 comment
Open
3 tasks done

Comments

@dynamicapps
Copy link

Preflight Checklist

Power Query SDK

0.4.0

Regression From

No response

Platform

Windows

Architecture

x64

OS Version

Windows 11

VSCode version

1.91.1

PQSdkTool Path

No response

Bug Description

This isn't an issue with the tool, but regarding modifying the sample code. If I remove "optional" from the DefaultConnector.Contents parameter, I get "Credentials are required to connect to the DefaultConnector source". I have credentials set and it works fine until I make this change.
I'm thinking having this work in the sample is important because I understand optional parameters are not displayed in the Power BI connector configuration GUI and are just assigned null.

SETTING CREDENTIALS:
[3:11:26 PM] [Info] CreateAuthState {
"Details": {
"Kind": "DefaultConnector",
"Path": "DefaultConnector",
"NormalizedPath": "DefaultConnector",
"IsDefaultForKind": false
},
"Message": "Successfully set credential",
"Status": "Success"
}
...
RUN WITHOUT CHANGES
[3:11:39 PM] [Info] RunTestBattery result [
{
"ActivityId": "770e4cd9-88be-45ff-8fc2-1c0732284696",
"DataSourceAnalysis": [
{
"Kind": "DataSource",
"FunctionName": "DefaultConnector.Contents",
"DataSource": {
"Kind": "DefaultConnector",
"NormalizedPath": "DefaultConnector",
"Path": "DefaultConnector"
}
}
],
"Details": "// Use this file to write queries to test your data connector\r\nlet\r\n result = DefaultConnector.Contents()\r\nin\r\n result\r\n",
"EndTime": "2024-07-14T19:11:39.2428572+00:00",
"Method": "PQTest.RunTest",
"Name": "DefaultConnector.query.pq",
"StartTime": "2024-07-14T19:11:38.3535741+00:00",
"Output": [
{
"Value": "Hello from DefaultConnector: (no message)"
}
],
"DiagnosticEvents": {},
"RowCount": 1,
"Status": "Passed",
"Type": "PQTest.Expression"
}
]
...
RUN WITH PASSING IN A STRING
[3:11:59 PM] [Info] RunTestBattery result [
{
"ActivityId": "98016a87-8190-45e2-8d53-fc39e529f32e",
"DataSourceAnalysis": [
{
"Kind": "DataSource",
"FunctionName": "DefaultConnector.Contents",
"DataSource": {
"Kind": "DefaultConnector",
"NormalizedPath": "DefaultConnector",
"Path": "DefaultConnector"
}
}
],
"Details": "// Use this file to write queries to test your data connector\r\nlet\r\n result = DefaultConnector.Contents("xyzzy")\r\nin\r\n result\r\n",
"EndTime": "2024-07-14T19:11:59.7930444+00:00",
"Method": "PQTest.RunTest",
"Name": "DefaultConnector.query.pq",
"StartTime": "2024-07-14T19:11:58.8065551+00:00",
"Output": [
{
"Value": "Hello from DefaultConnector: xyzzy"
}
],
"DiagnosticEvents": {},
"RowCount": 1,
"Status": "Passed",
"Type": "PQTest.Expression"
}
]
...
RUN HAVING REMOVED "OPTIONAL" FROM PARAMETER
[3:12:30 PM] [Info] RunTestBattery result [
{
"ActivityId": "b1e1417d-c9ba-4e4a-b826-c9ec24a2616d",
"DataSourceAnalysis": [
{
"Kind": "DataSource",
"FunctionName": "DefaultConnector.Contents",
"DataSource": {
"Kind": "DefaultConnector",
"NormalizedPath": "{"message":"xyzzy"}",
"Path": "{"message":"xyzzy"}"
}
}
],
"Details": "Credentials are required to connect to the DefaultConnector source. (Source at {"message":"xyzzy"}.)",
"EndTime": "2024-07-14T19:12:30.3237535+00:00",
"Method": "PQTest.RunTest",
"Name": "DefaultConnector.query.pq",
"StartTime": "2024-07-14T19:12:29.3827084+00:00",
"DiagnosticEvents": {},
"RowCount": 0,
"Status": "Failed",
"Type": "PQTest.Expression",
"Error": {
"Message": "Credentials are required to connect to the DefaultConnector source. (Source at {"message":"xyzzy"}.)",
"Details": {
"Microsoft.Data.Mashup.CredentialError.Reason": "CredentialMissing",
"Microsoft.Data.Mashup.CredentialError.DataSourceKind": "DefaultConnector",
"Microsoft.Data.Mashup.CredentialError.DataSourcePath": "{"message":"xyzzy"}",
"Microsoft.Data.Mashup.MashupSecurityException.Reason": "CredentialMissing",
"Microsoft.Data.Mashup.MashupSecurityException.DataSources": "[{"kind":"DefaultConnector","path":"{\"message\":\"xyzzy\"}"}]"
}
}
}
]

Steps to Reproduce

  1. Launch SDK extension.
  2. Modify DefaultConnector.pq by removing "optional" from the parameter in DefaultConnector.Contents.
  3. Pass a string in to the call to DefaultConnector.Contents in DefaultConnector.query.pq.
  4. Set Credentials.
  5. Evaluate DefaultConnector.query.pq

Actual Experience

Results pane shows output with message.

Expected Experience

Error "Credentials are required to connect to the DefaultConnector source."

Additional Context

No response

@dynamicapps
Copy link
Author

I was able to resolve this only by both deleting the .mez file in bin and setting credentials again. Not sure why this is happening, but I guess it has something to do with the project after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant