fix(firestore-send-email): kit/extension parity – invalid .env values leave mail unprocessed or silently change behaviour

Aperta
#3,295 0 commenti 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
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
firebase, typescript
Ambito
backend, devtools

Direzione di ricerca

Start with kits/firestore-send-email/src/export-config.ts, helpers.ts, and the startup path in index.ts; compare how .env values are handled with assertRequiredParams and the extension validation in firestore-send-email/extension.yaml. Then review the README section at kits/firestore-send-email/README.md#L235-L246. Done means startup validates the listed settings and blank URI case, errors clearly, and the README explains quoting JSON values in .env.

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

Descrizione

kits parity type: bug

firestore-send-email kit/extension parity. Priority: medium. Some bad or blank settings in .env stop mail without any ERROR state. Others silently change behaviour. The extension rejected all of these at install.

Difference
  • Extension: the platform rejects values outside a select list or regex, and fills blank optional params with their defaults.
  • Kit: values read from .env are never checked (only prompt answers are), and the runtime coerces them:
.env value Extension Kit
TTL_EXPIRE_TYPE=days (or a label such as Day) rejected at install deploys; every document is left with no delivery field. The only log is Unhandled error occurred during processing: Error: Unknown TTL expire type: days at INFO
SMTP_CONNECTION_URI= with AUTH_TYPE=UsernamePassword allowed every document is left with no delivery field; only a WARNING Invalid URI on each call
TTL_EXPIRE_VALUE = 0, abc or 1.5 / -1 rejected becomes 1 / expireAt in the past
AUTH_TYPE=oauth2 or ApiKey rejected silently uses the SMTP URI
OAUTH_SECURE=yes, TRUE or blank rejected / blank becomes true false
TLS_OPTIONS="{\"ca\":\"…\n…\"}" (double-quoted PEM) stored as typed the .env parser turns \n into newlines, the JSON fails to parse, and certificate checks are turned off with only a warning

The README says a bad value "fails at send time with delivery.state: ERROR". That isn't true for the first two rows.

Reproduced
  • TTL_EXPIRE_TYPE=days and a blank SMTP_CONNECTION_URI were each deployed on a kit instance. Documents written afterwards never got a delivery field, and the logs above appeared on every call.
  • Extensions validateOnly rejected days, 0, abc and oauth2.
  • The other rows come from running the kit's config code and the CLI's .env parser locally.
Code
Resolution

Validate select and int values once at startup, the way assertRequiredParams handles blanks, and fail loudly. That covers TTL_EXPIRE_TYPE, TTL_EXPIRE_VALUE, AUTH_TYPE, OAUTH_SECURE and a blank URI under UsernamePassword. Correct the README section, and tell users to single-quote JSON values in .env.

Lingua principale
TypeScript
Stelle
979
Fork
436
Merge medio
2g 13h
PR unite (30g)
18

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 firebase/extensions

Tutte le issue di firebase/extensions

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.