Catch provider setup errors instead of crashing the server at boot
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 83/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- node.js, typescript
- Área
- backend
Línea de trabajo
Empieza en packages/server/src/handler.ts, en la creación del proveedor cerca de la línea 18 y en el await de handleChat cerca de la línea 33. Después, lee las pruebas existentes del handler en packages/server/tests/handler.test.ts, que simulan createProvider. Comprueba cómo se devuelven los errores al generar una respuesta y cómo se cubren la validación y el límite de solicitudes. El trabajo estará terminado cuando se gestione y registre una sola vez el rechazo durante la configuración, las solicitudes devuelvan { error: 'provider_error' } y las pruebas incluyan un changeset de tipo patch para @chatcops/server.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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 atryand 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 mockscreateProvider) - Changeset for
@chatcops/server(patch) -
pnpm -r build,pnpm testandpnpm -r typecheckpass
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13
- Forks
- 7
- Merge medio
- 4 h 11 min
- PR fusionados (30 d)
- 122
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/chatcops
-
enhancement hacktoberfest help wanted server
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Document the pre-chat formPosiblemente ocupada @masyarakatai la tomó hace 5 días. Abiertodocumentation good first issue hacktoberfest widget
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
codercops/chatcops#70 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
enhancement hacktoberfest help wanted server
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Create @chatcops/store-redis for Upstash and other Redis clientsPosiblemente ocupada @bhushan4work la tomó hace 1 día. Abiertoenhancement hacktoberfest help wanted server
codercops/chatcops#248 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Create @chatcops/store-sqlite, a store for single-server setupsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoenhancement hacktoberfest help wanted server
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/chatcops
Issues similares
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
xavxyz/bei-shan-lin-shui#57 ·
Los mantenedores suelen responder en 1 día
-
[BUG] rag: sentence content can cross the reported sentence boundariesPosiblemente ocupada @LJK-ikun la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
platformatic/mcp#361 ·
Los mantenedores suelen responder en 1 día
-
最近文档这个弹窗,左右宽度没有最小宽度限制Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
siyuan-note/siyuan#20799 · 7 comentarios ·
Los mantenedores suelen responder en 1 día