Skip to content

🐛 Copilot: Not reading the App token #3240

Closed
@skeletonz28

Description

@skeletonz28

Workspace

copilot

📜 Description

We have set out our config to read the GitHub App tokens as part of our setup
This has always been working for our Backstage application
Yet when we installed this plugin, it complains that it cannot find a token
The understanding is that it would read the application and use that to auth
The only difference in how we implement it is using a file as reference, but this shouldn't be an issue

integrations:
github:
- host: github.com
apiBaseUrl: https://api.github.com
apps:
- $include: gh-rnd.yaml
clientId: {cID}
clientSecret: {cs}
allowedInstallationOwners:
-rnd

The include file has the required fields:

appId: {appid}
clientId: {cid}
clientSecret: {cs}
webhookSecret: some-secret
privateKey: |
{pk}
org: {org}
installationId: {iid}

As mentioned, this setup works perfectly within the main application of Backstage
Yet when promoting the CoPilot plugin, the app fails stating there is no PAT available

👍 Expected behavior

It should use the GitHub application token

👎 Actual Behavior with Screenshots

On a local, while debugging. Same as in our RnD

Image

ForwardedError: Plugin 'copilot' startup failed; caused by Error: Enterprise API for copilot only works with "classic PAT" tokens. No token is configured for "github.com" in the config.
[1] at (/Users/github/backstage-application/node_modules/@backstage/backend-app-api/src/wiring/BackendInitializer.ts:392:21)
[1] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[1] at (/Users/github/backstage-application/node_modules/@backstage/backend-app-api/src/wiring/BackendInitializer.ts:391:13)
[1] ... 3 lines matching cause stack trace ...
[1] at BackstageBackend.start (/Users/github/backstage-application/node_modules/@backstage/backend-app-api/src/wiring/BackstageBackend.ts:38:11) {
[1] cause: Error: Enterprise API for copilot only works with "classic PAT" tokens. No token is configured for "github.com" in the config.
[1] at Object.getCopilotConfig (/Users/github/backstage-application/node_modules/@backstage-community/plugin-copilot-backend/src/utils/GithubUtils.ts:52:11)
[1] at Function.fromConfig (/Users/github/backstage-application/node_modules/@backstage-community/plugin-copilot-backend/src/client/GithubClient.ts:52:18)
[1] at createRouter (/Users/github/backstage-application/node_modules/@backstage-community/plugin-copilot-backend/src/service/router.ts:126:34)
[1] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[1] at Object.init (/Users/github/backstage-application/node_modules/@backstage-community/plugin-copilot-backend/src/plugin.ts:40:11)
[1] at (/Users/github/backstage-application/node_modules/@backstage/backend-app-api/src/wiring/BackendInitializer.ts:391:13)
[1] at async Promise.allSettled (index 23)
[1] at BackendInitializer.#doStart (/Users/github/backstage-application/node_modules/@backstage/backend-app-api/src/wiring/BackendInitializer.ts:331:21)
[1] at BackendInitializer.start (/Users/github/backstage-application/node_modules/@backstage/backend-app-api/src/wiring/BackendInitializer.ts:245:5)
[1] at BackstageBackend.start (/Users/github/backstage-application/node_modules/@backstage/backend-app-api/src/wiring/BackstageBackend.ts:38:11)
[1] }

👟 Reproduction steps

In integrations config, use the includes for the app auth, and remove user and token for the PAT

📃 Provide the context for the Bug.

Pasted in actual behaviour
Can provide more if needed

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

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

No, I don't have time to work on this right now

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions