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.

Deprecation: [@octokit/rest] "number" parameter is deprecated for ".issues.createComment()". Use "issue_number" instead

See original GitHub issue

Bug Report

Current Behavior I’m currently getting this deprecation error with probot v9.2.6.

This is the code path:

probotApp.app = function app(probotRouter) {
  probotRouter.on("issue_comment.created", commentAdded);
};

async function commentAdded(context) {
  if (context.payload.sender.type === "Bot") {
    return;
  }

  const issueComment = context.issue({body: "Thanks for adding a comment!"});
  return context.github.issues.createComment(issueComment);
}

Deprecation: [@octokit/rest] “number” parameter is deprecated for “.issues.createComment()”. Use “issue_number” instead at Object.keys.forEach.key (/app/node_modules/probot/node_modules/@octokit/rest/plugins/register-endpoints/register-endpoints.js:73:26) at Array.forEach (<anonymous>) at Object.patchedMethod [as createComment] (/app/node_modules/probot/node_modules/@octokit/rest/plugins/register-endpoints/register-endpoints.js:69:26) at commentAdded (/app/src/probot-app.js:117:32) at Application.<anonymous> (/app/node_modules/probot/lib/application.js:153:50) at step (/app/node_modules/probot/lib/application.js:43:23) at Object.next (/app/node_modules/probot/lib/application.js:24:53) at fulfilled (/app/node_modules/probot/lib/application.js:15:58)

Expected behavior/code I expect no deprecation errors

Environment

  • Probot version(s): v9.2.6
  • Node/npm version: node 10.15.3 / npm v6.4.1
  • OS: alpine linux (in docker container node:10-alpine)

Additional context/Screenshots

I’m also having an issue with this code where the bot’s issue comment is being created 4 times even though the createComment() method is only called once. But I’m not sure if these two issues are related.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
gr2mcommented, Dec 19, 2019

It cannot be fixed without a breaking change, so we hold back until v10

2reactions
gr2mcommented, Jul 5, 2019

This is just a deprecation warning, not an Error. It should not affect your app

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecation warning "number" parameter is ... - GitHub
When use issues.createComment() , deprecation warning appeared. Deprecation: [@octokit/rest] "number" parameter is deprecated for ".issues.
Read more >
octokit/rest.js - GitHub Pages
For example to retrieve a pull request, use octokit.rest.pulls.get() . ... the results. number is deprecated - we recommend that you use created...
Read more >
octokit | Yarn - Package Manager
The octokit package integrates the three main Octokit libraries. API client (REST API requests, GraphQL API queries, Authentication); App client (GitHub App ...
Read more >
How to create a comment in a pull request using octokit?
Now as we have got the octokit instance, we can now create comment using Github API's client octokit. octokit.rest.issues.createComment({ owner, ...
Read more >
how to fix octokit.authenticate() is deprecated - Stack Overflow
Use "auth" constructor option instead. How can I fix it? my code module.exports = { getInstance: () => ...
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