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

Can't add actions to scaffolder.ts #9

Open
arhill05 opened this issue Jun 28, 2023 · 4 comments
Open

Can't add actions to scaffolder.ts #9

arhill05 opened this issue Jun 28, 2023 · 4 comments

Comments

@arhill05
Copy link

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
Copy link
Contributor

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
Copy link
Author

@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
Copy link
Author

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
Copy link
Contributor

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?

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

2 participants