GithubOrganizer icon indicating copy to clipboard operation
GithubOrganizer copied to clipboard

Missing import

Open dnanaklouvi opened this issue 3 years ago • 3 comments

Hi Ted,

We recently added an app to a self-hosted version of the GitHub app and below is the log of what happened. It threw an error in one of the pods being used.

2022-01-25T09:50:01Z return await self.app(scope, receive, send)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 199, in call

2022-01-25T09:50:01Z await super().call(scope, receive, send)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 112, in call

2022-01-25T09:50:01Z await self.middleware_stack(scope, receive, send)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 181, in call

2022-01-25T09:50:01Z raise exc from None

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in call

2022-01-25T09:50:01Z await self.app(scope, receive, _send)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 82, in call

2022-01-25T09:50:01Z raise exc from None

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in call

2022-01-25T09:50:01Z await self.app(scope, receive, sender)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 580, in call

2022-01-25T09:50:01Z await route.handle(scope, receive, send)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 241, in handle

2022-01-25T09:50:01Z await self.app(scope, receive, send)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 52, in app

2022-01-25T09:50:01Z response = await func(request)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 215, in app

2022-01-25T09:50:01Z dependant=dependant, values=values, is_coroutine=is_coroutine

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 151, in run_endpoint_function

2022-01-25T09:50:01Z return await run_in_threadpool(dependant.call, **values)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/site-packages/starlette/concurrency.py", line 40, in run_in_threadpool

2022-01-25T09:50:01Z return await loop.run_in_executor(None, func, *args)

2022-01-25T09:50:01Z File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run

2022-01-25T09:50:01Z result = self.fn(*self.args, **self.kwargs)

2022-01-25T09:50:01Z File "/app/main.py", line 28, in github_webhook

2022-01-25T09:50:01Z return installation_payload(data)

2022-01-25T09:50:01Z File "/app/main.py", line 62, in installation_payload

2022-01-25T09:50:01Z install = ghapp.get_installation(install_id)

2022-01-25T09:50:01Z NameError: name 'ghapp' is not defined

- This is the error message we are getting.

dnanaklouvi avatar Jan 26 '22 15:01 dnanaklouvi

I can take a look this weekend, or if you're up for it I can review a PR that has a fix. Let me know either way!

tedivm avatar Jan 26 '22 15:01 tedivm

Hi Ted - that sound's great. I'll get back to my team and I'll respond immediately as soon as we know which time and if we have a PR that you can look at.

dnanaklouvi avatar Jan 27 '22 00:01 dnanaklouvi

Hi Ted,

Looks like I fixed this error by updating the www.py file with the following import:

from githuborganizer.services.github import ghapp, get_organization_client

image

tobes64 avatar Jan 28 '22 12:01 tobes64