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

510
Visualizações
Firebase 'internal' error when using Functions and Admin

I am having trouble with some functions that have been working previously. I have created a function to let the user create another user and it was working fine. Functions that do not use Admin works fine just as before.

However, due to some Firebase updates, the function broke and I am getting an 'internal' error. I had to change import firebase from "firebase/app"; to import firebase from "firebase/compat/app"; as well as import "firebase/compat/functions"; but that did not work, as well as updating firebase to "^9.8.1", but that did not work either.

Here is my web function:

async registerUser(userInfo) {
    const functions = getFunctions();
    const createUser = httpsCallable(functions, "createUser");
      // Used to have this: 
      // let createUser = firebase.functions().httpsCallable("createUser");

    //Call to function where it breaks.
    return await createUser({
       //User data here
    })
      .then( 
    //stuff happens here
    ).catch((error) => {
      //Error happens here
})
}

Here is the function that was already deployed in Firebase:

const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();

  exports.createUser = functions.https.onCall(async (userData) => {
    return await admin
    .auth()
    .createUser(userData)
    .then(() => {
      return { isError: false };
    })
    .catch((error) => {
      return { isError: true, errorMessage: error };
    });
});

Here is the response log:

Request Method: OPTIONS
Status Code: 403 
Referrer Policy: strict-origin-when-cross-origin
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
content-length: 305
content-type: text/html; charset=UTF-8
date: Tue, 24 May 2022 16:04:14 GMT
server: Google Frontend
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can refer to the Admin SDK error handling page and check the Structure of the error, the refer to policy: strict-origin-when-cross-origin part gives us a good starting point.

But first, we can see the root cause of this issue as in the same page we have a table for Platform error codes where:

INTERNAL | Internal server error. Typically a server bug.

In the Firebase Admin Authentication API Errors we have a similar table where:

auth/internal-error | The Authentication server encountered an unexpected error while trying to process the request. The error message should contain the response from the Authentication server containing additional information. If the error persists, please report the problem to our Bug Report support channel.

Now talking about the cors message, this question suggests:

Consider importing like this, as shown in the samples:

const cors = require('cors')({origin: true});

And the general form of your function will be like this:

 exports.fn = functions.https.onRequest((req, res) => {
   cors(req, res, () => {
       // your function body here - use the provided req and res from cors
   })
});

You might need to make some changes to the structure as the question has some time, so I will also leave the reference to the Call functions via HTTP requests and check if it works for you.

I will follow up if you provide updates and consider submitting a bug report as previously mentioned by the documentation if this is necessary.

about 4 years ago · Juan Pablo Isaza Relatório
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