Skip to content

fix: form submission reliability — reCAPTCHA timing, error handling, logging (v1.0.5) - #378

Merged
johannesparty merged 5 commits into
mainfrom
fix/form-reliability
Jul 19, 2026
Merged

fix: form submission reliability — reCAPTCHA timing, error handling, logging (v1.0.5)#378
johannesparty merged 5 commits into
mainfrom
fix/form-reliability

Conversation

@johannesparty

Copy link
Copy Markdown
Collaborator

Summary

Fixes several contact-form reliability issues surfaced while diagnosing "Unable to send message" / stuck-on-"Sending…" reports, and adds diagnostics so future failures are self-explanatory in the log.

Changes (one commit each)

  • Airtable logging (class-bd4d.php): log the real HTTP status and the Airtable response body on send failure. The prior "success" line fired for any completed request regardless of status, and the non-200 failure branch logged nothing — making failures undiagnosable.
  • reCAPTCHA verify hardening (class-google-recaptcha.php): add a 10s timeout and log HTTP/JSON errors plus the full Google result (success, score, action, error-codes) on failed verification.
  • Frontend reliability (main.js + built assets):
    • Generate the reCAPTCHA v3 token at submit time instead of page load. v3 tokens expire ~2 min after generation, so page-load minting caused intermittent failures for slower form-fillers.
    • Add an AJAX error/timeout handler (30s) so failed submissions show an error instead of hanging on "Sending…".
  • Docs (README.md): add a "Rotating the Airtable Token" runbook (diagnose the 403 INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND, issue a new PAT scoped to the base, verify).
  • Version bump to 1.0.5.

Root causes found during investigation

  1. The live Airtable Personal Access Token had lost access to the base (owned by a departed account) → all submissions 403'd. Fixed operationally by issuing a new token; this PR adds the logging that pinpointed it.
  2. The frontend had no AJAX error handler, so any failure (including the cached-page nonce 403 seen when testing while logged into wp-admin) hung the button silently.

Test plan

  • Anonymous/private-browser submission succeeds → debug.log shows Airtable API responded HTTP 200.
  • After deploy: confirm a forced failure surfaces an error message instead of hanging on "Sending…".
  • After deploy: confirm reCAPTCHA no longer fails for slow submissions.

Deployment notes

  • Built assets (main.min.js etc.) are committed — no rebuild needed at deploy.
  • Merge uses squash/rebase (linear history enforced on main).

🤖 Generated with Claude Code

johannesparty and others added 5 commits July 18, 2026 19:50
The silent SEND_ERROR branch (non-200 Airtable responses) logged nothing, and the prior success line fired for any completed request regardless of status. Log the real HTTP status and the Airtable response body so send failures are diagnosable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a 10s request timeout and log HTTP/JSON errors plus the full Google result (success, score, action, hostname, error-codes) on failed verification, so intermittent reCAPTCHA failures can be diagnosed from the log.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
reCAPTCHA v3 tokens expire ~2 minutes after generation, so minting the token once at page load caused failures for anyone slow to fill out the form. Generate a fresh token at submit time instead. Also add an AJAX error/timeout handler (30s) so failed submissions surface an error instead of hanging on 'Sending...'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document how to diagnose (403 INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND in debug.log) and fix an expired/revoked Airtable token by issuing a new PAT scoped to the BD4D-Relationships-Main XRM base.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@johannesparty
johannesparty merged commit 4e996e7 into main Jul 19, 2026
3 checks passed
@johannesparty
johannesparty deleted the fix/form-reliability branch July 19, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant