AOSSIE-Org / AOSSIE-Org/DebateAI

Auth endpoints (/signup, /login) return empty responses instead of JSON on error

Open
#243 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
84
Forks
198
Avg merge
2d 19h
Merged PRs (30d)
30

Description

🐞 Problem
Both `/signup` and `/login` endpoints sometimes return an empty response body instead of a JSON response when an error occurs.

This causes the frontend to fail with the following error:

Failed to execute 'json' on 'Response': Unexpected end of JSON input

Image

Expected Behavior

The backend should always return a valid JSON response (success or error) for auth endpoints,

Actual Behavior

On certain error paths (e.g. validation failure, user already exists, password mismatch, JWT/bcrypt error), the handler exits without calling c.JSON(...), resulting in an empty response body.

Impact

Frontend crashes during signup/login

New users cannot complete authentication

Poor developer onboarding experience for local setup

Steps to Reproduce

Run backend and frontend locally as per README

Attempt signup or login

Observe frontend error: Unexpected end of JSON input

I have reproduced this issue locally and would like to work on fixing it. Please let me know if I can proceed and submit a PR.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the backend handlers for the `/signup` and `/login` endpoints and reproduce the error using the local setup described in the README. Trace validation, existing-user, password, JWT, and bcrypt error paths; done means every success and error path returns valid JSON so the frontend no longer gets an empty response.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.