Skip to content

[Bug] add-data-source reports success but code generation fails for shared_powerplatformadminv2 #326

@ranjith7022

Description

@ranjith7022

add-data-source succeeds but service generation fails for shared_powerplatformadminv2

Summary

When adding the Power Platform for Admins V2 connector as a data source, the CLI reports Data source added successfully, but the model/service generation step fails with:

The definition does not contain a valid 'properties' node.

The data source is added to power.config.json, and schema metadata is written under .power/schemas, but no generated service/model file is emitted under src.

Command Run

npx power-apps add-data-source --non-interactive --api-id shared_powerplatformadminv2 --connection-id 6255fa9eb4354858a95d4c7143103d22

I also captured the output with:

npx power-apps add-data-source --non-interactive --api-id shared_powerplatformadminv2 --connection-id 6255fa9eb4354858a95d4c7143103d22 2>&1 | Tee-Object -FilePath power-apps-add-data-source-no-resource.log

Expected Behavior

The CLI should add the data source and generate the corresponding TypeScript model/service files under src.

Actual Behavior

The CLI writes the connection reference to power.config.json and ends with:

Data source added successfully.
Hint: Run 'npx power-apps run' to test locally, or 'npx power-apps push' to deploy.

But during code generation, it logs this failure:

[[scenario:failure] ModelServiceGenerator.GenerateModelService]:  {
  schemaFilePath: 'C:\Users\mailr\Desktop\now\codetest-experiment\.power\schemas\powerplatformadminv2\powerplatformadminv2.Schema.json',
  error: Error: Error processing schema at path 'C:\Users\mailr\Desktop\now\codetest-experiment\.power\schemas\powerplatformadminv2\powerplatformadminv2.Schema.json': The definition does not contain a valid 'properties' node.
      at generateModelService (.../node_modules/@microsoft/power-apps-actions/dist/CodeGen/modelServiceGenerator.js:71:23)
      at async handleAddCdpDataSourceAsync (.../node_modules/@microsoft/power-apps-actions/dist/Actions/AddDataSource.js:402:9)
      at async addCdpDataSourceAsync (.../node_modules/@microsoft/power-apps-actions/dist/Actions/AddDataSource.js:216:5)
      at async addDataSourceAsync (.../node_modules/@microsoft/power-apps-actions/dist/Actions/AddDataSource.js:71:9)
      at async addDataSourceAsync (.../node_modules/@microsoft/power-apps-cli/dist/Verbs/AddDataSource.js:53:5)
}

Resulting Config

power.config.json is updated with:

"connectionReferences": {
  "<generated-guid>": {
    "id": "/providers/Microsoft.PowerApps/apis/shared_powerplatformadminv2",
    "displayName": "Power Platform for Admins V2",
    "dataSources": [
      "powerplatformadminv2"
    ],
    "authenticationType": "oauth2-auth",
    "dataSets": {}
  }
}

Environment

OS: Windows
Node package manager: npm
@microsoft/power-apps: 1.1.1
@microsoft/power-apps-vite: 1.0.2
Command: npx power-apps add-data-source
Connector API ID: shared_powerplatformadminv2
Connection ID: 6255fa9eb4354858a95d4c7143103d22

Question

Is shared_powerplatformadminv2 currently unsupported by the Code Apps generator, or is the generated connector schema missing a shape that ModelServiceGenerator.GenerateModelService expects?

It would be helpful if the CLI either generated usable service files for this connector or reported a clearer warning that the data source was added but code generation is unsupported for this schema.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions