diff --git a/octomachinery/cli/__main__.py b/octomachinery/cli/__main__.py index a9b0e69..83fffe3 100644 --- a/octomachinery/cli/__main__.py +++ b/octomachinery/cli/__main__.py @@ -121,6 +121,7 @@ async def _process_event_as_app( from ..app.runtime.context import RUNTIME_CONTEXT from ..app.config import BotAppConfig from ..github.api.app_client import GitHubApp + from aiohttp.client import ClientSession from aiohttp.web_request import Request config = BotAppConfig.from_dotenv() from aiohttp.http_parser import RawRequestMessage @@ -148,11 +149,16 @@ class transp: async def read_coro(): return json.dumps(event_data).encode() http_request.read = read_coro - async with GitHubApp(config.github) as github_app: - RUNTIME_CONTEXT.github_app = ( # pylint: disable=assigning-non-slot - github_app - ) - await route_github_webhook_event(http_request) + async with ClientSession() as http_client_session: + async with GitHubApp( + config.github, + http_session=http_client_session, + ) as github_app: + # pylint: disable=assigning-non-slot + RUNTIME_CONTEXT.github_app = ( + github_app + ) + await route_github_webhook_event(http_request) def main():