0

I'm trying to test my scheduled functions locally using nodejs 16*. Doesn't seem to kick off. When i do try to run it from the browser i get the following error.

functions: TypeError: Cannot read properties of undefined (reading 'data')

This how i try to force it -

http://localhost:5001/<my_projectt_id>/us-central1/cronAppData-0

This is the scheduled task. Run on the cloud fine, only failing locally.

const cronAppData = functions.pubsub
                        .schedule('*/1 * * * *')
                        .onRun(async(context) => {

    // this is another fuction doing the processing (doesn't make it this far)
    const data = await run();    
    return;
});

Any ideas?

Rodrigo Rubio
  • 1,686
  • 2
  • 16
  • 26
  • GOLD! Thank you man. A note for #google - it's easy to understand why services/solutions like #supabase were born and growing. #firebase documentation is all over the shop. C'mon guys, get it together. – Rodrigo Rubio Jun 15 '23 at 11:08
  • As per @Roopa, way around this for the moment can be found here - https://stackoverflow.com/questions/75094518/do-firebase-scheduled-functions-run-automatically-on-the-emulator – Rodrigo Rubio Jun 15 '23 at 11:13
  • Just out of curiosity (and without polemics) did you try a Google search on "Firebase scheduled function run on emulator" before asking your question? – Renaud Tarnec Jun 15 '23 at 11:51
  • 1
    I did and also used Bard. First and foremost, the place where I'd expect to find this would be under Firebase documentation. But no dice. – Rodrigo Rubio Jun 15 '23 at 13:28
  • It is in the documentation: https://firebase.google.com/docs/functions/local-emulator and you actually find this page as the second result of the Google search – Renaud Tarnec Jun 15 '23 at 16:35
  • I did come across this at some stage, but the instruction is vague. Unless you manage to become an firebase expert, the following leaves it to your imagination, don't you think? This doesn't answer much - firebase emulators:exec "./my-test.sh" – Rodrigo Rubio Jun 16 '23 at 02:24

0 Answers0