Parfuemerie-Douglas / scaffolder-backend-module-azure-repositories

A collection of Backstage scaffolder backend modules for Azure repositories.
https://www.npmjs.com/package/@parfuemerie-douglas/scaffolder-backend-module-azure-repositories
Apache License 2.0
9 stars 21 forks source link

Can't add actions to scaffolder.ts #9

Open arhill05 opened 1 year ago

arhill05 commented 1 year ago

Hello! I'm following the instructions in the readme, but when I add the actions to my existing array of actions in scaffolder.ts, I get the following error:

[1] C:\backstage\packages\backend\dist\main.js:444
[1] /******/                    throw e;
[1]                             ^
[1]
[1] TypeError: (0 , smithy_client_1.withBaseException) is not a function
[1]     at Object.<anonymous> (C:\backstage\node_modules\@parfuemerie-douglas\scaffolder-backend-module-azure-repositories\node_modules\@aws-sdk\client-sso\dist-cjs\protocols\Aws_restJson1.js:263:65)
[1]     at Module._compile (node:internal/modules/cjs/loader:1254:14)
[1]     at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
[1]     at Module.load (node:internal/modules/cjs/loader:1117:32)
[1]     at Module._load (node:internal/modules/cjs/loader:958:12)
[1]     at Module.require (node:internal/modules/cjs/loader:1141:19)
[1]     at require (node:internal/modules/cjs/helpers:110:18)
[1]     at Object.<anonymous> (C:\backstage\node_modules\@parfuemerie-douglas\scaffolder-backend-module-azure-repositories\node_modules\@aws-sdk\client-sso\dist-cjs\commands\GetRoleCredentialsCommand.js:9:25)
[1]     at Module._compile (node:internal/modules/cjs/loader:1254:14)
[1]     at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
[1]     at Module.load (node:internal/modules/cjs/loader:1117:32)
[1]     at Module._load (node:internal/modules/cjs/loader:958:12)
[1]     at Module.require (node:internal/modules/cjs/loader:1141:19)
[1]     at require (node:internal/modules/cjs/helpers:110:18)
[1]     at Object.<anonymous> (C:\backstage\node_modules\@parfuemerie-douglas\scaffolder-backend-module-azure-repositories\node_modules\@aws-sdk\client-sso\dist-cjs\SSO.js:5:37)
[1]     at Module._compile (node:internal/modules/cjs/loader:1254:14)
[1]
[1] Node.js v18.15.0

Here's the dependencies in my package.json:

  "dependencies": {
    "@backstage/backend-common": "^0.19.0",
    "@backstage/backend-tasks": "^0.5.3",
    "@backstage/catalog-client": "^1.4.2",
    "@backstage/catalog-model": "^1.4.0",
    "@backstage/config": "^1.0.8",
    "@backstage/integration": "^1.5.0",
    "@backstage/plugin-app-backend": "^0.3.46",
    "@backstage/plugin-auth-backend": "^0.18.4",
    "@backstage/plugin-azure-devops-backend": "^0.3.25",
    "@backstage/plugin-catalog-backend": "^1.10.0",
    "@backstage/plugin-catalog-backend-module-azure": "^0.1.17",
    "@backstage/plugin-permission-common": "^0.7.6",
    "@backstage/plugin-permission-node": "^0.7.9",
    "@backstage/plugin-proxy-backend": "^0.2.40",
    "@backstage/plugin-scaffolder-backend": "^1.15.0",
    "@backstage/plugin-search-backend": "^1.3.2",
    "@backstage/plugin-search-backend-module-pg": "^0.5.7",
    "@backstage/plugin-search-backend-node": "^1.2.2",
    "@backstage/plugin-techdocs-backend": "^1.6.3",
    "@mdude2314/backstage-plugin-scaffolder-git-actions": "1.1.0",
    "@mdude2314/backstage-plugin-scaffolder-json-merge-actions": "^1.1.0",
    "@mdude2314/backstage-plugin-scaffolder-npm-actions": "^1.1.0",
    "@mdude2314/backstage-plugin-search-backend-module-azure-devops-wiki": "^0.4.0",
    "@parfuemerie-douglas/scaffolder-backend-module-azure-pipelines": "^1.0.0-next.5",
    "@parfuemerie-douglas/scaffolder-backend-module-azure-repositories": "^0.2.4-next.2",
    "@plusultra/plugin-scaffolder-dotnet-backend": "^1.1.1",
    "app": "link:../app",
    "dockerode": "^3.3.1",
    "express": "^4.17.1",
    "express-promise-router": "^4.1.0",
    "json-merger": "^1.1.9",
    "pg": "^8.3.0",
    "winston": "^3.2.1"
  }

And the code in scaffolder, obfuscated for brevity/secrets:

/// scaffolder.ts
import {
  cloneAzureRepoAction,
  pushAzureRepoAction,
  pullRequestAzureRepoAction,
} from '@parfuemerie-douglas/scaffolder-backend-module-azure-repositories';

 const builtInActions = createBuiltinActions({
    catalogClient,
    integrations,
    config: env.config,
    reader: env.reader,
  });

  const actions = [
    ...builtInActions,
    cloneAzureRepoAction({ integrations }),
    pushAzureRepoAction({ integrations, config: env.config }),
    pullRequestAzureRepoAction({ integrations }),
    dotnetNewAction(),
    dotnetBuildAction(),
    gitCloneAction(),
    gitAction(),
    dotnetInstallTemplateAction(),
    createNpmExecAction(),
    createNpmInitAction(),
    createNpmInstallAction(),
    createNpmConfigAction(),
    createJsonMergeFilesAction(),
    createJsonMergeFileAction(),
  ];

  return await createRouter({
    logger: env.logger,
    config: env.config,
    database: env.database,
    reader: env.reader,
    catalogClient,
    actions,
  });

Any ideas what I'm missing here?

hevans-dglcom commented 1 year ago

It could be that the integrations package @backstage/integration has a different version between our plugin and your core backstage. Can you check that?

arhill05 commented 11 months ago

@hevans-dglcom apologies for the late response, I went on vacation!

I tried forcing the version of @backstage/integration to 1.4.5 in both my backend-core and this plugin, but it still didn't work - I get the same error.

arhill05 commented 11 months ago

I'm wondering if it has something to do with this note in the docs for this plugin:

Note: If you are using this plugin in a Backstage monorepo that contains the code for @backstage/plugin-scaffolder-backend, you need to modify your internal build processes to transpile files from the node_modules folder as well.

Could you clarify what needs to be done for this?

hevans-dglcom commented 11 months ago

Hi @arhill05 we have published a new version (0.2.5) with updated backstage dependancies. Can you check if the issue is solved with the upgrade?