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

Providing API key through config does not work #64

Open
KaoruDev opened this issue Jul 31, 2023 · 1 comment
Open

Providing API key through config does not work #64

KaoruDev opened this issue Jul 31, 2023 · 1 comment

Comments

@KaoruDev
Copy link

Bug

I'm trying to programatically create agent tokens using:

    const agentToken = new buildkite.agent.AgentToken("my-token", {});

and keep running into the following error:

non-200 OK status code: 401 Unauthorized body: "{\n  \"errors\": [\n    {\n      \"message\": \"Authentication required. Please supply a valid API Access Token: https://buildkite.com/docs/apis/graphql-api#authentication\"\n    }\n  ]\n}\n"

I have set buildkite:api_token to a valid API token and even setup a Provider manually:

export const BK_PROVIDER = new buildkite.Provider("bk-provider", {
  apiToken: new Config("buildkite").requireSecret("apiToken"),
  organization: "bint",
});

Workaround

Setting the BUILDKITE_API_TOKEN and clearing out the buildkite:api_token seems to work.

@mechanical-fish
Copy link

I've just run into this myself. Using the environment variable works, but the buildkite:api_token config does not.

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