42f8602457
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.
22 lines
725 B
Bash
22 lines
725 B
Bash
#!/usr/bin/env bash
|
|
# entrypoint.sh — Start soul-demo then neuron-web in the same container.
|
|
#
|
|
# soul-demo runs in the background on :7772 (localhost only, not exposed).
|
|
# neuron-web runs in the foreground on :8080 (Cloud Run health checks this).
|
|
# If neuron-web exits, the container exits. Soul crashing is non-fatal —
|
|
# chat will return "demo soul not responding" but the page stays up.
|
|
|
|
set -euo pipefail
|
|
|
|
echo "[entrypoint] starting soul-demo on :7772"
|
|
/usr/local/bin/soul-demo &
|
|
SOUL_PID=$!
|
|
|
|
# Give the soul a few seconds to load its engram and seed safety nodes
|
|
sleep 4
|
|
|
|
echo "[entrypoint] soul-demo started (pid=$SOUL_PID)"
|
|
echo "[entrypoint] starting neuron-web on :${PORT:-8080}"
|
|
|
|
exec /usr/local/bin/neuron-web
|