Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Catch provider setup errors instead of crashing the server at boot

クローズ 初心者向け
#175 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
83/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
backend

調査の方向性

packages/server/src/handler.tsで、18行目付近のプロバイダー作成と、33行目付近のhandleChat内のawaitを確認し、続いてcreateProviderをモックするpackages/server/tests/handler.test.tsの既存のハンドラーテストを読みます。返信生成の失敗がどのように返されるか、検証とレート制限がどのようにテストされているかを確認します。セットアップ時の拒否が処理されて一度だけログに記録され、リクエストが{ error: 'provider_error' }を返し、テストに@chatcops/serverのpatch changesetが含まれていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug good first issue hacktoberfest server

createChatHandler starts creating the provider right away and only awaits it inside the first request (packages/server/src/handler.ts, line 18 and line 33). If that promise rejects, for example with an unknown provider.type or a provider SDK that throws on a missing key, nothing handles the rejection. Node treats an unhandled rejection as fatal by default, so the whole server process exits at startup. After that, if the process survives, every request rethrows at line 33, outside the try that starts further down, and the visitor gets a bare internal_error.

What to do

  • Handle the rejection where the promise is created, and log it once with the [chatcops] prefix, for example [chatcops] Provider setup failed: <message>. Don't log the API key or the config object.
  • In handleChat, await the provider inside a try and yield { error: 'provider_error' } when setup failed, the same error the visitor already sees for a failed reply.
  • Keep request validation and rate limiting working as they do today.

Acceptance criteria

  • A handler created with a provider whose setup rejects doesn't cause an unhandled rejection (a test can listen for unhandledRejection, or check that the rejection is handled)
  • Requests to that handler yield { error: 'provider_error' } and the setup error is logged once, not once per request
  • Tests in packages/server/tests/handler.test.ts (it already mocks createProvider)
  • Changeset for @chatcops/server (patch)
  • pnpm -r build, pnpm test and pnpm -r typecheck pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.

主要言語
TypeScript
スター
13
フォーク
7
平均マージ
3時間 41分
マージ済み PR(30日)
155

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codercops/chatcops のほかの issue

codercops/chatcops の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。