Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Run the docs site's chat endpoint on the Cloudflare adapter

Fermée
#202 5 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@Pratham2511 y travaille déjà.

Depuis le 21/10/2026.

  • #297 par @Pratham2511 — fusionnée

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
72/100
Type d'issue
Refactorisation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript
Domaine
api, backend

Piste de recherche

Read website/src/pages/api/chat.ts and the chatcopsCloudflareHandler adapter from @chatcops/server/cloudflare, then check how locals.runtime.ctx is provided by @astrojs/cloudflare. Replace the endpoint's custom stream handling with the adapter while preserving rate limiting and cf-connecting-ip handling, and configure the site's origin for CORS. Done when OPTIONS and POST return the same origin header and the website build and local chat work as described in the issue.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

hacktoberfest help wanted website

The docs site's chat endpoint (website/src/pages/api/chat.ts) builds its own SSE response around handleChat (the POST handler from line 79) instead of using chatcopsCloudflareHandler from @chatcops/server/cloudflare. The site runs on Cloudflare Workers, so it should run the same adapter users do: that way the site tests it, and fixes like #195 (stop the provider when the visitor leaves) don't have to be copied by hand. The OPTIONS handler (line 133) also answers Access-Control-Allow-Origin: * while POST sends no CORS header at all.

What to do

  • Build the adapter once per isolate, the same lazy way the file builds the handler today (the API key only exists inside a request through getSecret), and call it from POST and OPTIONS.
  • Pass the Workers context so waitUntil works. With @astrojs/cloudflare 14 it's locals.cfContext (locals.runtime.ctx was removed and throws). ogcops does the same in src/pages/api/og.ts.
  • Set cors to the site's own origin (https://chat.codercops.com) instead of *.
  • Keep the rate limiting and the cf-connecting-ip handling the file has now.

Acceptance criteria

  • website/src/pages/api/chat.ts no longer has its own stream loop
  • The chat on the site still works locally with pnpm --filter @chatcops/website dev (say how you tested it)
  • OPTIONS and POST send the same Access-Control-Allow-Origin
  • pnpm --filter @chatcops/website build succeeds
  • No changeset needed (website only)

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.

Langage dominant
TypeScript
Étoiles
13
Forks
7
Merge moyen
3 h 33 min
PR mergées (30 j)
176

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de codercops/chatcops

Toutes les issues de codercops/chatcops

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.