Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!