question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] ##[error]Parameter token or opts.auth is required

See original GitHub issue

Resume

I’m receiving the error ##[error]Parameter token or opts.auth is required on this run on my CI

Proofs

image image

Description & code digging

I found this issue actions/toolkit#324 by googling the error returned.

On this line of code of this action is used:

const octokit = new github.GitHub(token);

In the package @actions/github on this line of code (which probably raises the error) is used:

constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>)
  constructor(opts: Octokit.Options)
  constructor(token: string | Octokit.Options, opts?: Octokit.Options) {
    super(GitHub.getOctokitOptions(GitHub.disambiguate(token, opts)))

    this.graphql = GitHub.getGraphQL(GitHub.disambiguate(token, opts))
  }

Github extends Ocktokit. So is super = Ocktokit

In the package @ocktokit/core on this line of code there’s the following explanation/documentation:

constructor(options: OctokitOptions = {}) {
[...]

// (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
    //     is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.
    // (2) If only `options.auth` is set, use the default token authentication strategy.
    // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
    // TODO: type `options.auth` based on `options.authStrategy`.

Questions

Should be passed others args besides the token on this line from the action?

const octokit = new github.GitHub(token);

The construct does accept other options:

constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>)

On the official documentation of @actions/github is used only token on the constructor.

Did we miss some official documentation? Should issues be opened on @actions/github and @ocktokit/core?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
conarrocommented, May 16, 2020

I just ran into this error as well. I had stored the GH_TOKEN at the org-level initially. When I moved it to a repo-level secret, the action worked!

1reaction
rodrigondeccommented, May 17, 2020

@rodrigondec some people had issues using GH_TOKEN and GITHUB_TOKEN can you try renaming your secret to something else? #33

Sure, I’ll modify and post the results.

But if this is the cause the problem lies on the lib used (@actions/github and @ocktokit/core).

Considering I’m using GH_TOKEN on my other projects and it’s working perfectly fine.

https://github.com/imobanco/icnab240/runs/679469380?check_suite_focus=true

Proof

image

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] ##[error]Parameter token or opts.auth is required #465
auth ` are set, the `octokit` instance // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred. //...
Read more >
GitHub Actions tells me the token is unspecified when I try to ...
According to the README for the upload-release-asset action, the token has to be set in the environment: - name: Upload Release Asset id: ......
Read more >
Azure AD authentication & authorization error codes
Authentication failed due to flow token expired. Expected - auth codes, refresh tokens, and sessions expire over time or are revoked by the...
Read more >
Request for authentication token fails with "Missing required ...
As part of login process authentication token has to be obtained ... This command returns "Missing required parameter 'grant_type'" error.
Read more >
express-jwt - npm
It is possible that some tokens will need to be revoked so they cannot be used any longer. You can provide a function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found