Cloudflare wizard overwrites `src/index.ts` and reports success without setting up Sentry

Aperta
#1,394 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
cli, devtools

Direzione di ricerca

Start in src/cloudflare/sdk-setup.ts at createSentryInitFile and in src/cloudflare/templates.ts at getCloudflareWorkerTemplateWithHandler, and trace how the wrangler main entry is resolved when the file is missing or already exists. Done means existing files are never overwritten, a missing main target gets a Sentry-enabled worker or a clear message, and the wizard does not print the success outro when Sentry was not set up. Ask in the issue thread which behavior the maintainers want for case B before changing it.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Cloudflare Workers
Environment

@sentry/wizard master (b262ed0, 9.1.0 plus one commit), Cloudflare integration. Reproduced by running createSentryInitFile directly, not a full wizard run.

Steps to Reproduce

Case A, no main in the wrangler config:

  1. Have a wrangler.jsonc without main and an existing src/index.ts.
  2. Run npx @sentry/wizard -i cloudflare.

Case B, main points to a missing file:

  1. Set "main": "nope.ts" without creating that file.
  2. Run npx @sentry/wizard -i cloudflare.
Expected Result
  • Existing files are never overwritten.
  • A newly created worker is set up with Sentry.
  • The wizard does not report success if Sentry was not set up.
Actual Result
  • Case A: src/index.ts is overwritten with a plain worker template that contains no Sentry code.
  • Case B: no file is created or changed, and no message is shown for it.

From reading the code, both cases continue to the "Sentry has been successfully configured for your Cloudflare project." outro, and case A also adds main: src/index.ts to the wrangler config.

See createSentryInitFile in src/cloudflare/sdk-setup.ts and getCloudflareWorkerTemplateWithHandler in src/cloudflare/templates.ts.

Lingua principale
TypeScript
Stelle
297
Fork
88
Merge medio
5h 29m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/sentry-wizard

Tutte le issue di getsentry/sentry-wizard

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.