octokit / octokit.net

A GitHub API client library for .NET
https://octokitnet.readthedocs.io/en/latest/
MIT License
2.68k stars 1.07k forks source link

404 when creating a new issue on github #2326

Closed ANF-Studios closed 3 years ago

ANF-Studios commented 3 years ago

Hello, there, I am creating a test issue (possibly without an account or any authorization method) using Octokit 0.5.0 on GitHub on my repository. I'm not really sure why I am getting a 404, I searched everywhere including GitHub's own documentation, no luck, could you explain me what I'm doing wrong here:

var client = new GitHubClient(new ProductHeaderValue("WinPath"));
var createIssue = new NewIssue("This is a test issue.");
var issue = client.Issue.Create("ANF-Studios", "WinPath", createIssue);
Console.WriteLine(issue.Result.Url);

This is the exception:

Unhandled exception. System.AggregateException: One or more errors occurred. (Not Found)
 ---> Octokit.NotFoundException: Not Found
   at Octokit.Connection.HandleErrors(IResponse response) in /home/runner/work/octokit.net/octokit.net/Octokit/Http/Connection.cs:line 700
   at Octokit.Connection.RunRequest(IRequest request, CancellationToken cancellationToken) in /home/runner/work/octokit.net/octokit.net/Octokit/Http/Connection.cs:line 681
   at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken) in /home/runner/work/octokit.net/octokit.net/Octokit/Http/Connection.cs:line 666
   at Octokit.ApiConnection.Post[T](Uri uri, Object data, String accepts, String contentType, CancellationToken cancellationToken) in /home/runner/work/octokit.net/octokit.net/Octokit/Http/ApiConnection.cs:line 293
{"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/issues#create-an-issue"}
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Program.Main()

Thanks in advance.

shiftkey commented 3 years ago

Hello, there, I am creating a test issue (possibly without an account or any authorization method) using Octokit 0.5.0 on GitHub on my repository.

You need to provide credentials when creating an issue on GitHub: https://octokitnet.readthedocs.io/en/latest/getting-started/#authenticated-access

ANF-Studios commented 3 years ago

Credentials? This can cause a security risk for my application, isn't there some way to do that without? Can you guide me, I'm not sure what exactly to do here.

shiftkey commented 3 years ago

This can cause a security risk for my application, isn't there some way to do that without?

Alternatives I can think of:

The latter has a walkthrough with how to integrate it with Octokit.net: https://octokitnet.readthedocs.io/en/latest/oauth-flow/