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.

handleGitHubInstallation doesn't handle empty repositories

See original GitHub issue

Saw this error pop up a couple of times today on prod:

io.dockstore.webservice.resources.WorkflowResource: GitHub app installed on the repositories (agduncan94)
! java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
! at io.dockstore.webservice.resources.WorkflowResource.lambda$handleGitHubInstallation$22(WorkflowResource.java:2028)
...
"POST /workflows/github/install HTTP/1.0" 500 110 "-" "-" 3

ArrayIndexOutOfBoundsException is thrown at https://github.com/dockstore/dockstore/blob/1.9.1/dockstore-webservice/src/main/java/io/dockstore/webservice/resources/WorkflowResource.java#L2028 indicating the repository string didn’t contain a /.

The io.dockstore.webservice.resources.WorkflowResource: GitHub app installed on the repositories (agduncan94) resulting from https://github.com/dockstore/dockstore/blob/1.9.1/dockstore-webservice/src/main/java/io/dockstore/webservice/resources/WorkflowResource.java#L2022 leads us to believe that repositories was empty (thanks @garyluu ).

Additional context

  • Webservice version: 1.9.1
  • host location: dockstore.org

┆Issue is synchronized with this Jira Story ┆Issue Number: DOCK-1556 ┆Sprint: Sprint 47- Vampire Squid ┆Issue Type: Story

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
agduncan94commented, Aug 28, 2020

Summary of what is happening. We do not distinguish between installation_repositories events for adding or removing installations. The action key in the GitHub event can be used to determine if it is an install or uninstall (added and removed respectively).

The uninstall/remove action is calling the installation endpoint on the dockstore webservice with the following information installationId=xxxxxxx&username=agduncan94&repositories=

Note the empty repositories string. This is because we were looking at the repositories_added field of the GitHub event. For uninstall events, there is a repositories_removed field.

There are two solutions I can think of

  1. We don’t care about uninstall events. Check in the lambda that installation_repositories events have the “added” action. If so, then call the endpoint, else don’t do anything. This might be a good quick fix to prevent the 500 errors we keep seeing.

  2. We care about install events. The lambda must pass along the action “added” or “removed” to the endpoint (workflows/github/install) on our web service. It must also find the list of repositories from the correct location (either repositories_added or repositories_removed). The endpoint on our web service will be updated to keep track of both action types. Might need to create a new event ENUM for uninstall.

See https://developer.github.com/webhooks/event-payloads/#installation_repositories for more information.

1reaction
coverbeckcommented, Nov 12, 2020

Ticket review blocked until dockstore/lambda#30 is deployed (to dev)

@GFJHogue This is deployed to dev

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting cloning errors - GitHub Docs
If you're having trouble cloning a repository, check these common errors.
Read more >
Count number of empty repositories on GitHub - Stack Overflow
Save this question. Show activity on this post. I was just wondering if it's possible to count the total number of empty repositories...
Read more >
Manage projects - GitLab Docs
If a project or repository has been updated but the state is not reflected in the UI, you may need to clear the...
Read more >
Set up a Git repository | PyCharm Documentation - JetBrains
Check out a project from a remote host (clone) · Put an existing project under Git version control · Exclude files from version...
Read more >
Classic SysAdmin: How to Run Your Own Git Server
One of the limitations of GitHub is that the free service doesn't allow private ... git init --bare Initialized empty Git repository in ......
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