Skip to content

connector-namespace CLI: connection invoke crashes on array response body (OneDrive folder listing) #131

@manvkaur

Description

@manvkaur

Bug Report

Description

az connector-namespace connection invoke crashes with a Python deserialization error when the upstream connector returns an array response body instead of a dict/object. This affects multiple connectors including OneDrive for Business and SharePoint Online.

Repro Steps

  1. Create a Connector Namespace with a OneDrive for Business or SharePoint Online connection
  2. Authorize the connection (OAuth consent)
  3. Invoke an API that returns an array:
# OneDrive folder listing
az connector-namespace connection invoke \
  -g <resource-group> --namespace <namespace> \
  --connection-name <connection-name> \
  --request "{method:GET,path:'/datasets/default/folders'}" \
  -o json

# SharePoint site/library listing
az connector-namespace connection invoke \
  -g <resource-group> --namespace <namespace> \
  --connection-name <connection-name> \
  --request "{method:GET,path:'/datasets'}" \
  -o json

Expected Behavior

The command should return the connector response wrapped in the standard envelope:

{
  "response": {
    "statusCode": 200,
    "body": [ { "Id": "...", "Name": "FolderName", "IsFolder": true, ... }, ... ]
  }
}

Actual Behavior

The CLI extension crashes with:

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: Expect <class 'dict'>, got [{'Id': '...', 'Name': '1ESBot', ...}, ...]

The data IS returned (visible in the error message), but the CLI's Python deserialization layer rejects it because it expects a dict and receives a list.

Affected Connectors

  • onedriveforbusiness — folder listing (/datasets/default/folders)
  • sharepointonline — site/library listing (/datasets)
  • Likely any connector operation that returns a JSON array rather than a JSON object

Impact

  • Prevents using connection invoke for interactive browsing (folder picker, site picker) in postdeploy scripts.
  • Any connector operation that returns an array body will hit this same issue.

Environment

  • Azure CLI: 2.75.0
  • connector-namespace extension: installed via irm https://aka.ms/connector-namespace-cli-install-ps | iex
  • OS: Windows 11

Workaround

Currently falling back to pre-setting resource IDs via azd env set (e.g. ONEDRIVE_FOLDER_ID, SHAREPOINT_SITE_URL).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions