Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
Firebase Pubsub Schedule Job can't run result is: "UNAUTHENTICATED"

I'm trying to realise a leaderboard for my App which should rewrite every 24h, but I can't get it to work... The job doesn't even start.

This is all I found about the function, but it doesn't help me. https://firebase.google.com/docs/functions/schedule-functions

And this is my function:

exports.leaderboardjob = functions.region('europe-west1').pubsub.schedule( '0 0 * * *').onRun(async (context) => {
    await leaderboard();
    console.log("job done");
    return null;
});

async function leaderboard(){

    const rdb = admin.firestore();

    const ref = rdb.ref('users');

    try {
        await ref.orderByChild('xp').limitToLast(2).on('child_added', (snapshot) => { //test first with 2 results
            console.log(snapshot.key);
        });

    } catch (error) {
         console.log('error: ' + error.message);
    }

    return{
        result: ok
    }
}

I already moved the function to my region europe-west1 like all my other functions.

error that I get back when I call this function (leaderboardjob) manually:

{"@type":"type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished", "jobName":"projects/censored/locations/europe-west1/jobs/firebase-schedule-leaderboardjob-europe-west1", "pubsubTopic":"projects/censored/topics/firebase-schedule-leaderboardjob-europe-west1", "status":"UNAUTHENTICATED", "targetType":"PUB_SUB"}

Maybe its just not possible, if not: can someone explain me how to realise something like this with functions?

EDIT: I forgot to tell, that I gave the function the role with a new account "pubsub.subscriber"

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I just deleted the whole function and tested it with a new name.

I don't know why, but this worked...

You don't even need to add a role. Everything works just fine.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda