0

I'm trying to debug firebase function on my local windows

as described in https://medium.com/@mwebler/debugging-firebase-functions-with-vs-code-3afab528bb36

I do

set FIREBASE_CONFIG={  databaseURL: 'https://invoice-manager-251609.firebaseio.com',  storageBucket: 'invoice-manager-251609.appspot.com',   projectId: 'invoice-manager-251609'}

functions start

and get

┌────────┬────────┬─────────┬─────────────────────────────────────────────────────────────────┐
│ Status │ Name   │ Trigger │ Resource                                                        │
├────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────┤
│ FAILED │ upload │ HTTP    │ http://localhost:8010/invoice-manager-251609/us-central1/upload │
├────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────┤
│ FAILED │ tst    │ HTTP    │ http://localhost:8010/invoice-manager-251609/us-central1/tst    │
├────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────┤
│ FAILED │ tst1   │ HTTP    │ http://localhost:8010/invoice-manager-251609/us-central1/tst1   │
└────────┴────────┴─────────┴─────────────────────────────────────────────────────────────────┘

if I do firebase emulators:start

I get

undefinedWarning, estimating Firebase Config based on GCLOUD_PROJECT.

Initializing firebase-admin may fail[2019-10-06T11:44:51.932Z] @firebase/database: FIREBASE FATAL ERROR: Cannot parse Firebase url.

Please use https://.firebaseio.com

I also tried:

functions debug tst1

and get:

ERROR: Function worker crashed with exit code: 9 undefined(node:21096) [DEP0062] DeprecationWarning: `node --debug

and

node --debug-brkare invalid. Please usenode --inspectornode --inspect-brk` instead.

I tried with node-10 and node-8

I also tried this: https://medium.com/@david_mccoy/build-and-debug-firebase-functions-in-vscode-73efb76166cf

and this https://rominirani.com/google-cloud-functions-tutorial-debugging-local-functions-357c24829198

I get the same errors

whats going on?

how do I debugging firebase on local windows?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Elia Weiss
  • 8,324
  • 13
  • 70
  • 110
  • I don't believe that the current suite of Firebase emulators supports debugging functions. That tutorial is kind of old. If you're having an issue with the emulator, please post an issue to GitHub. https://github.com/firebase/firebase-tools – Doug Stevenson Oct 06 '19 at 13:53
  • This is not correct: I was able to debug the functions with Firebase emulators on my local windows with devTool step-through – Elia Weiss Oct 07 '19 at 05:26

1 Answers1

1

The guides in the question are correct, but when running in Emulator, u have to set the db url manually

admin.initializeApp({
    databaseURL: "https://<YOUR FIREBASE>.firebaseio.com"
  });

here is the full cmd list:

functions start

functions deploy --trigger-http --timeout 600s funcName

functions inspect funcName

After that u can use chrome://inspect/ to connect to the process with the chrome debugger.

If you have issues, u can use:

functions logs read

NOTE: after functions start I still get the table with FAILED status - I ignore it

Elia Weiss
  • 8,324
  • 13
  • 70
  • 110