Skip to content

fix(site): improve error handling for /contact - #1017

Open
BaoT1301 wants to merge 2 commits into
mainfrom
fix/740-contact-error-handling
Open

fix(site): improve error handling for /contact#1017
BaoT1301 wants to merge 2 commits into
mainfrom
fix/740-contact-error-handling

Conversation

@BaoT1301

Copy link
Copy Markdown
Contributor

Description

Fixes #740

The public inquiry action on /contact forwarded the caught error's raw message directly to the client:

throwActionError(err instanceof Error ? err.message : 'An unknown error occurred.');

That can leak internal details to end users (upstream HTTP status codes, a missing CONTACT_GOOGLE_SCRIPT_URL config error, or other exception text that should never leave the server).

What changed

  • The full error is still logged server-side with logger.error for diagnosis.
  • The caller now always receives a fixed, generic message ("We could not submit your inquiry right now. Please try again later."), regardless of the underlying failure.

Tests

  • Updated the failure-path test to assert the generic message is thrown, that the raw internal message (Sheets is down) is not surfaced to the caller, and that the full internal error is still logged server-side.

No UI or behavior change beyond the error text the user sees on a failed submission.

Checklist

  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • Any components that you've modified are accessible.
  • You've used conventional commits where appropriate

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
internal-dashboard Ready Ready Preview, Comment Jul 17, 2026 12:14am
nightcrawler Ready Ready Preview, Comment Jul 17, 2026 12:14am

The public inquiry action on /contact forwarded the caught error's raw
message straight to the client via throwActionError(err.message). That
can surface internal details to end users, such as upstream HTTP status
codes, a missing CONTACT_GOOGLE_SCRIPT_URL config error, or other
exception text that should never leave the server.

Now the full error is still logged server-side with logger.error for
diagnosis, but the caller receives a fixed, generic message ("We could
not submit your inquiry right now. Please try again later.") regardless
of the underlying failure.

Updated the failure test to assert the generic message is thrown, that
the raw internal message is not surfaced, and that the full error is
still logged.
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.

Improve error handling for /contact

1 participant