Octokit instantiation fails for authenticated webhook events
See original GitHub issueBug 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:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you could add a failing test here, that’d be ace https://github.com/probot/probot/blob/310dd3eeea7a4dca9c54fe09e8f9d4a5a0d5a0ac/test/index.test.ts#L50-L95
I did not, I called
Probot.run(app)
where app was a module I imported