Skip to content

fix: show the real signup error instead of "Unexpected Error" - #345

Merged
DaStormer merged 1 commit into
devfrom
fix/342-signup-errors
Sep 15, 2026
Merged

DaStormer merged 1 commit into
devfrom
fix/342-signup-errors

Conversation

@hassan1brahim

Copy link
Copy Markdown
Collaborator

What was done

  • Replaced the res_json.body check in SignUp with res_json.message in app/lib/actions.ts
  • Added a signupErrorMessage helper that maps the errors /create returns to clearer signup messages
  • Passed unrecognized backend messages through instead of replacing them with a generic error
  • Kept Unexpected Error only when the backend sends no message

Why

Every failed signup was showing Unexpected Error.

The frontend was reading res_json.body, but body is part of the Lambda → API Gateway response envelope. API Gateway consumes that wrapper, so the frontend actually receives:

{
  statusCode: 400,
  message: 'Duplicate user!'
}

That meant res_json.body was always undefined and every failure fell back to the generic error.

This change reads message instead and maps the known /create errors to clearer, actionable messages. Matching uses lowercased substrings rather than exact strings because the backend wiki and handler differ slightly in wording.

Closes #342

@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
frontendv2 Ready Ready Preview Sep 15, 2026 1:30pm UTC

Request Review

@DaStormer
DaStormer self-requested a review September 15, 2026 15:10
@DaStormer DaStormer linked an issue Sep 15, 2026 that may be closed by this pull request
@DaStormer
DaStormer merged commit 4bc762c into dev Sep 15, 2026
4 checks passed
@DaStormer
DaStormer deleted the fix/342-signup-errors branch September 15, 2026 15:13
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.

display sign up errors

2 participants