backstage icon indicating copy to clipboard operation
backstage copied to clipboard

🐛 Bug Report: No matching host for Bitbucket Server

Open Jofairden opened this issue 1 year ago • 1 comments

📜 Description

I have a clean installation of Backstage Here's what we added for the configuration:

        bitbucketServer:
          - host: <redacted>
            apiBaseUrl: <redacted>
            token: ${BITBUCKET_TOKEN}

and

catalog:
  providers:
    bitbucketServer:
      bitbucket:
        host: '<redacted>'
        catalogPath: /catalog-info.yaml
        filters:
          skipArchivedRepos: true
        schedule:
          # supports cron, ISO duration, "human duration" as used in code
          frequency: { minutes: 1 }
          # supports ISO duration, "human duration" as used in code
          timeout: { minutes: 3 }
  import:
    entityFilename: catalog-info.yaml
    pullRequestBranchName: feature/backstage
  rules:
    - allow: [Component, System, API, Resource, Location]
  locations:
    - type: file
      target: ../../catalog-info.yaml
    - type: file
      target: ../../examples/org.yaml
      rules:
        - allow: [User, Group]

👍 Expected behavior

It should connect with our Bitbucket server Please note: we have tried the bitbucket host with and without https:// and with and without a trailing slash character to no avail.

👎 Actual Behavior with Screenshots

During Backstage startup, we are seeing the following error:

2024-05-07T08:05:04.855Z search info Starting all scheduled search tasks.
/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1781
throw new errors.ForwardedError(
^
ForwardedError [InputError]: Module 'bitbucket-server-entity-provider' for plugin 'catalog' startup failed; caused by InputError: No BitbucketServer integration found that matches host <redacted>
at /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1781:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1780:13
at async processNode (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1302:22)
... 7 lines matching cause stack trace ...
at async BackstageBackend.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1881:5) {
cause: InputError: No BitbucketServer integration found that matches host <redacted>
at /opt/app-root/src/dynamic-plugins-root/backstage-plugin-catalog-backend-module-bitbucket-server-dynamic-0.1.26/dist/index.cjs.js:229:15
at Array.map (<anonymous>)
at BitbucketServerEntityProvider.fromConfig (/opt/app-root/src/dynamic-plugins-root/backstage-plugin-catalog-backend-module-bitbucket-server-dynamic-0.1.26/dist/index.cjs.js:223:40)
at Object.init [as func] (/opt/app-root/src/dynamic-plugins-root/backstage-plugin-catalog-backend-module-bitbucket-server-dynamic-0.1.26/dist/index.cjs.js:368:88)
at /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1780:35
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async processNode (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1302:22)
at async Promise.all (index 2)
at async processMoreNodes (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1297:7)
at async _DependencyGraph.parallelTopologicalTraversal (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1308:5)
at async /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1777:9
at async Promise.all (index 1)
at async BackendInitializer.doStart_fn (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1757:3)
at async BackendInitializer.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1611:5)
at async BackstageBackend.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/index.cjs.js:1881:5) {
cause: undefined
}
}

👟 Reproduction steps

1 Have a clean install for backstage 2 Follow the documentation instructions to add Bitbucket Server as a catalog provider

📃 Provide the context for the Bug.

All our code repos are on Bitbucket. It is highly necessary for this connection to work properly.

🖥️ Your Environment

Apple M3 We are also running Linux distros

👀 Have you spent some time to check if this bug has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

Jofairden avatar May 07 '24 08:05 Jofairden

it looks like you have put bitbucketServer under catalog.providers instead of under integrations as mentioned in https://backstage.io/docs/integrations/bitbucketServer/locations

integrations:
  bitbucketServer:
    - host: bitbucket.mycompany.com
      apiBaseUrl: https://bitbucket.mycompany.com/rest/api/1.0
      token: ${BITBUCKET_SERVER_TOKEN}

vinzscam avatar May 10 '24 18:05 vinzscam

it looks like you have put bitbucketServer under catalog.providers instead of under integrations as mentioned in https://backstage.io/docs/integrations/bitbucketServer/locations

integrations:
  bitbucketServer:
    - host: bitbucket.mycompany.com
      apiBaseUrl: https://bitbucket.mycompany.com/rest/api/1.0
      token: ${BITBUCKET_SERVER_TOKEN}

This was correct and solved this issue. Random question: do you know how we can configure SSL certificates?

Jofairden avatar May 14 '24 08:05 Jofairden

Closing since the issue is resolved 🎉

HTTPS can be configured in the backend config, although generally I'd recommend terminating HTTPS in a reverse proxy in front of the service. If you mean adding trusted certificates for outgoing connections you can use NODE_EXTRA_CA_CERTS.

Rugvip avatar May 16 '24 11:05 Rugvip