Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User with owner access to org gets 403 forbidden #238

Open
terrajobst opened this issue Jul 15, 2020 · 4 comments
Open

User with owner access to org gets 403 forbidden #238

terrajobst opened this issue Jul 15, 2020 · 4 comments
Labels
Type: Bug Something isn't working as documented

Comments

@terrajobst
Copy link

I have the following query:

            var query = new Query()
                .Repository(Var("repoName"), orgName)
                .Collaborators(first: 100, after: Var("after"), affiliation: CollaboratorAffiliation.Direct)
                .Select(connection => new
                {
                    connection.PageInfo.EndCursor,
                    connection.PageInfo.HasNextPage,
                    connection.TotalCount,
                    Items = connection.Edges.Select(e => new
                    {
                        e.Node.Login,
                        e.Permission,
                    }).ToList(),
                }).Compile();

            var result = new List<CachedUserAccess>();

            foreach (var repoName in repoNames)
            {
                var vars = new Dictionary<string, object>
                {
                    { "after", null },
                    { "repoName", repoName },
                };

                var current = await Connection.Run(query, vars);

that fails with

Unhandled Exception: System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
Full Exception
Unhandled Exception: System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at Octokit.GraphQL.Connection.<Run>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.GraphQL.Core.SimpleQuery`1.Runner.<RunPage>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Octokit.GraphQL.ConnectionExtensions.<Run>d__2`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.DotnetOrg.GitHubCaching.CacheLoader.<GetCachedTeamMembersAsync>d__14.MoveNext() in D:\a\1\s\src\Microsoft.DotnetOrg.GitHubCaching\CacheLoader.cs:line 194
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.DotnetOrg.GitHubCaching.CacheLoader.<LoadAsync>d__10.MoveNext() in D:\a\1\s\src\Microsoft.DotnetOrg.GitHubCaching\CacheLoader.cs:line 59
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.DotnetOrg.PolicyCop.Commands.CacheOrgCommand.<ExecuteAsync>d__7.MoveNext() in D:\a\1\s\src\policop\Commands\CacheOrgCommand.cs:line 38
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.DotnetOrg.PolicyCop.Program.<Main>d__0.MoveNext() in D:\a\1\s\src\policop\Program.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.DotnetOrg.PolicyCop.Program.<Main>(String[] args)

This error occurs in both the mono and xamarin orgs; However, the query succeeds in just fine in the orgs aspnet, dotnet, and xamarinhq. It's the same user in all cases and the user is an org owner in all orgs.

Any ideas?

@jcansdale
Copy link
Collaborator

jcansdale commented Jul 15, 2020

@terrajobst,

Unfortunately I haven't been able to repro this because I don't have push access. 😢

Octokit.GraphQL.Core.Deserializers.ResponseDeserializerException: Must have push access to view repository collaborators.
   at Octokit.GraphQL.Core.Deserializers.ResponseDeserializer.Deserialize[TResult](Func`2 deserialize, JObject data)

Any chance you could send up a repo with this running (and failing) as a workflow? 🙏

@terrajobst
Copy link
Author

terrajobst commented Jul 20, 2020

Unfortunately I can't repro this. Could you send me an email at immol at microsoft dot com? I can give you the necessary perms to repro this on our actual repos.

@terrajobst
Copy link
Author

It seems these are intermittent errors. Adding a re-try loop has pretty much solved this issue for me. Strange.

@github-actions
Copy link

github-actions bot commented Dec 3, 2022

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Dec 3, 2022
@kfcampbell kfcampbell added Priority: Normal Type: Bug Something isn't working as documented labels Dec 5, 2022
@github-actions github-actions bot removed the Status: Stale Used by stalebot to clean house label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

4 participants