Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

430
Visualizações
API resolved without sending a response Next js

I am building a project using next js and firebase. I use the API routes that next offers for signup and login. The code registers the users in firebase but I keep getting this warning: API resolved without sending a response for /api/auth/signup, this may result in stalled requests. This is the code in my /api/auth/signup/. Hopefully, you can help me fix it.

export default function signup(req, res){
if(req.method === 'POST'){
    const {body: {email, password, displayName}} = req;
    createUserWithEmailAndPassword(auth, email, password)
    .then((userCredential) => {
        updateProfile(userCredential.user, {displayName: displayName})
        const {uid, email, phoneNumber, photoURL} = userCredential.user;
        addDoc(collection(db, "users"), {
            id: uid,
            displayName: displayName,
            email: email,
            phoneNumber: phoneNumber,
            photoURL: photoURL,
        });
        res.json(userCredential.user)
    })
    .catch((err) => {
        console.log(err.code);
        console.log(err.message);
    });

} else {res.json({"error": "Route only available for POST method"})}

}

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda