Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Registering without a password returns a 500 instead of telling you what is missing

Abierto Apto para principiantes
#191 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
express, typescript

Línea de trabajo

Empieza en apps/http-server/src/controllers/authController.ts y compara la comprobación de campos obligatorios del controlador de registro con la del controlador de inicio de sesión. Añade cobertura para los campos ausentes y vacíos, y luego verifica que el ejemplo de curl responda con 400 e indique el campo que falta, y que el registro válido siga funcionando. El issue también sugiere revisar quizController e inviteController para detectar carencias similares en la validación del cuerpo de la solicitud.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Backend first issue bug good first issue help wanted

The register handler reads the body and goes straight to work:

// apps/http-server/src/controllers/authController.ts
export const userRegisterController = async (req: Request, res: Response) => {
    try {
        const { name, email, password } = req.body;

        const isUserExisted = await prisma.user.findUnique({ where: { email } })
        if (isUserExisted) return errorResponse(res, 400, "Email is already existed..")

        const hashedPassword = await bcrypt.hash(password, 10);   // throws when undefined

There is no presence check, so a missing field reaches bcrypt.hash(undefined, 10), which throws into the catch and returns a generic 500.

Confirmed against the live API:

POST /api/v1/auth/register  {"name":"t","email":"..."}     # no password
→ 500 {"success":false,"error":"Internal Server Error..."}

The sibling login handler in the same file already does it right:

if (!email || !password) return errorResponse(res, 400, "All fields are required...");
Why it matters

A 500 says "the server is broken". A 400 says "you forgot the password". Anyone integrating with the API, or debugging a form that failed to send a field, is sent looking in the wrong place entirely — and 500s are what you page on, so this also adds noise to any error monitoring.

What a fix looks like

The smallest version is the same guard login uses. Better, since zod ^4.3.6 is already a dependency: validate the shape properly and say which field is wrong, not just that something is.

Worth checking the other controllers for the same gap while you are there — quizController and inviteController have endpoints that read req.body directly too. If you find more, mention them in the PR; fixing them all in one change is fine as long as the description lists them.

Definition of done
curl -X POST .../api/v1/auth/register -H "Content-Type: application/json" -d "{\"email\":\"[email protected]\"}"
# → 400, naming the missing field
  • No request with a missing or empty field can reach bcrypt.hash
  • A valid registration still works exactly as before

Good first issue: a few lines, with a working example of the right pattern directly above it in the same file.

Lenguaje dominante
TypeScript
Estrellas
21
Forks
7
Merge medio
3 h 39 min
PR fusionados (30 d)
16

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TheCodeHeist-Coder/Rexial

Todos los issues de TheCodeHeist-Coder/Rexial

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.