Files
neuron-web/.gitignore
T
Will Anderson 42f8602457 fix: resend email send path - http_post_auth was dropping silently
The wrapper now logs the response and returns a structured ok/error
shape. Four call sites converge on a single send_email helper.
Resend deliveries verified end to end against
will.anderson@neurontechnologies.ai (delivery IDs 492fa066, 74258223,
69a3d9ab, f6d1c889).

Root cause: http_post_auth in dist/web_stubs.c only set the
Authorization: Bearer header. Resend rejects requests without
Content-Type: application/json with HTTP 422 missing_required_field
because it parses the body as form-urlencoded. The 422 response was
being captured by the El handler but not parsed, so callers logged
the error body and returned ok-200 to the client. Two endpoints also
built malformed JSON by interpolating the raw request body unquoted
into the text field.

Fix:
- Added http_post_auth_json (Bearer + Content-Type: application/json)
  alongside http_post_auth in dist/web_stubs.c. Stripe form-POST
  callers stay on http_post_auth, JSON callers (Resend now, others
  later) move to the json variant.
- New send_email(from_addr, to, subject, html, text) wrapper in
  src/main.el. JSON-escapes all user-provided fields, parses the
  Resend response into a structured ok/error envelope, and println's
  the outcome ([email] sent id=<id>) for Cloud Run log surfaces.
- Refactored four call sites onto the wrapper: /api/enterprise-inquiry,
  /api/developer-interest, /api/waitlist, /api/attest, the family
  invite branch in /api/family/invite, and both DocuSeal completion
  branches in /api/docuseal/webhook/<token>.
- Untracked dist/ source files (web_stubs.c, vessel_stubs.c,
  soul-demo.c, entrypoint.sh, engram-snapshot.json) are now committed
  - generated artifacts (main.c, binaries) stay ignored. Without this
  the next CI rebuild would regress the fix.
2026-05-02 12:37:54 -05:00

24 lines
705 B
Plaintext

.env
# Build output dir. Hand-written sources under dist/ are explicitly
# un-ignored at the bottom of this file - those must travel with the
# repo so future builds can re-produce a working image.
dist/*
.el/
src/*.elc
src/*.map.json
src/index.html
src/about.html
src/terms.html
src/enterprise-terms.html
# Track hand-written source under dist/ that is NOT generated by elc.
# These are the C stub shims and entry scripts the Dockerfile.stage COPYs
# into the image; without these the build cannot produce a working
# binary. Generated artifacts (main.c, main-combined.el, binaries) stay
# ignored.
!dist/web_stubs.c
!dist/vessel_stubs.c
!dist/soul-demo.c
!dist/entrypoint.sh
!dist/engram-snapshot.json