microsoft / microsoft/vscode-powerquery-sdk

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

Open
#334 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
92
Forks
23
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sample files DefaultConnector.pq and DefaultConnector.query.pq, then reproduce the listed steps in the Power Query SDK using the test battery. Compare behavior with the parameter marked optional and with it removed; done means the credential handling and result match the intended expected experience documented in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.