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.

Octokit instantiation fails for authenticated webhook events

See original GitHub issue

Bug Report

Current Behavior

When my bot receives a webhook from github, I receive the exception:

web    | ERROR (event): octokit/plugin-throttling error:
web    |         You must pass the onAbuseLimit and onRateLimit error handlers.
web    |         See https://github.com/octokit/rest.js#throttling
web    |
web    |         const octokit = new Octokit({
web    |           throttle: {
web    |             onAbuseLimit: (retryAfter, options) => {/* ... */},
web    |             onRateLimit: (retryAfter, options) => {/* ... */}
web    |           }
web    |         })
web    |
web    |     Error: octokit/plugin-throttling error:
web    |             You must pass the onAbuseLimit and onRateLimit error handlers.
web    |             See https://github.com/octokit/rest.js#throttling
web    |
web    |             const octokit = new Octokit({
web    |               throttle: {
web    |                 onAbuseLimit: (retryAfter, options) => {/* ... */},
web    |                 onRateLimit: (retryAfter, options) => {/* ... */}
web    |               }
web    |             })

If I inspect state.throttleOptions in get-authenticated-octokit it does not have those functions:

web    |   throttleOptions: {
web    |     Bottleneck: <ref *1> [Function: Bottleneck] {
web    |       default: [Circular *1],
web    |       Events: [Function: Events],
web    |       version: '2.19.5',
web    |       strategy: [Object],
web    |       BottleneckError: [Function: BottleneckError],
web    |       Group: [Function: Group],
web    |       RedisConnection: [Function: RedisConnection],
web    |       IORedisConnection: [Function: IORedisConnection],
web    |       Batcher: [Function: Batcher]
web    |     },
web    |     connection: IORedisConnection {
web    |       Redis: [Function],
web    |       clientOptions: {},
web    |       clusterNodes: null,
web    |       client: [Redis],
web    |       Promise: [Function: Promise],
web    |       Events: [Events],
web    |       on: [Function (anonymous)],
web    |       once: [Function (anonymous)],
web    |       removeAllListeners: [Function (anonymous)],
web    |       terminated: false,
web    |       subscriber: [Redis],
web    |       limiters: {},
web    |       ready: [Promise]
web    |     }
web    |   },

Instead it appears to be an object that we would use to create a set of throttle functions?

The state object is created in index.ts through getOctokitThrottleOptions which returns Bottleneck and a connection, so I’m unsure how this would ever have those functions.

Expected behavior/code I would expect the state’s throttleOptions to contain the throttle callbacks

Environment

  • Probot version(s): [e.g. v10.0.0]
  • Node/npm version: [e.g. Node 12.16.1/npm 6.13.4]
  • OS: Docker on OSX

Possible Solution

Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gr2mcommented, Aug 19, 2020
1reaction
tebrielcommented, Aug 19, 2020

I did not, I called Probot.run(app) where app was a module I imported

Read more comments on GitHub >

github_iconTop Results From Across the Web

octokit/rest.js - GitHub Pages
Now instantiate your octokit API. All options are optional, but authentication is strongly encouraged. const octokit = new Octokit({. You can set auth...
Read more >
GitHub Automation with Octokit - Learn With Jason
That's most often how it is the problem here. It's not. Requires authentication. Let's see, GitHub token, all right, let's do it this...
Read more >
GitHub Automation with Octokit (with Gregor Martynus)
GitHub has powerful APIs, and with Octokit we can do just about anything on GitHub through code. Gregor Martynus will teach us how!...
Read more >
octokitpy - PyPI
secret. string; secret provided to GitHub to sign webhook. events ... Instantiate a client with the authentication scheme and credentials that you want...
Read more >
@octokit/webhooks - npm
License. @octokit/webhooks helps to handle webhook events received from GitHub. ... Throws error if eventPayload or signature not passed.
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