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.
This commit is contained in:
+1
-1
@@ -84,7 +84,7 @@ else
|
||||
SED_INPLACE=(-i '')
|
||||
fi
|
||||
sed "${SED_INPLACE[@]}" \
|
||||
's|#include "el_runtime.h"|#include "el_runtime.h"\nel_val_t http_get_auth(el_val_t url, el_val_t tok);\nel_val_t http_post_auth(el_val_t url, el_val_t tok, el_val_t body);\nel_val_t http_delete_auth(el_val_t url, el_val_t bearer_tok, el_val_t apikey);\nel_val_t cwd(void);\nel_val_t color_bold(el_val_t s);\nel_val_t unix_timestamp(void);\nel_val_t gcs_write(el_val_t bucket, el_val_t object_name, el_val_t content);\nel_val_t gcs_read(el_val_t bucket, el_val_t object_name);\nel_val_t supabase_insert(el_val_t project_url, el_val_t service_key, el_val_t table, el_val_t row_json);\nel_val_t supabase_get(el_val_t project_url, el_val_t service_key, el_val_t table_and_query);\nel_val_t supabase_auth_user(el_val_t project_url, el_val_t anon_key, el_val_t user_jwt);\nel_val_t supabase_admin_invite(el_val_t project_url, el_val_t service_key, el_val_t body_json);\nel_val_t supabase_upsert_user(el_val_t project_url, el_val_t anon_key, el_val_t user_jwt, el_val_t table_and_query, el_val_t row_json);|' \
|
||||
's|#include "el_runtime.h"|#include "el_runtime.h"\nel_val_t http_get_auth(el_val_t url, el_val_t tok);\nel_val_t http_post_auth(el_val_t url, el_val_t tok, el_val_t body);\nel_val_t http_post_auth_json(el_val_t url, el_val_t tok, el_val_t body);\nel_val_t http_delete_auth(el_val_t url, el_val_t bearer_tok, el_val_t apikey);\nel_val_t cwd(void);\nel_val_t color_bold(el_val_t s);\nel_val_t unix_timestamp(void);\nel_val_t gcs_write(el_val_t bucket, el_val_t object_name, el_val_t content);\nel_val_t gcs_read(el_val_t bucket, el_val_t object_name);\nel_val_t supabase_insert(el_val_t project_url, el_val_t service_key, el_val_t table, el_val_t row_json);\nel_val_t supabase_get(el_val_t project_url, el_val_t service_key, el_val_t table_and_query);\nel_val_t supabase_auth_user(el_val_t project_url, el_val_t anon_key, el_val_t user_jwt);\nel_val_t supabase_admin_invite(el_val_t project_url, el_val_t service_key, el_val_t body_json);\nel_val_t supabase_upsert_user(el_val_t project_url, el_val_t anon_key, el_val_t user_jwt, el_val_t table_and_query, el_val_t row_json);|' \
|
||||
dist/main.c
|
||||
|
||||
echo "==> Building Docker image marketing:${TAG} for linux/amd64"
|
||||
|
||||
Reference in New Issue
Block a user