0

I have a Firebase Function with onCreate() function, which I would like to debug. My goal is, that when I add a new element in the Firebase Database, to stop the app at the breakpoint in the onCreate() function.

I tried to follow these steps but it's not working.

export const buySellSignal = functions.database.ref("/users/{userId}/signals/{signalId}")
  .onCreate((snapshot, context) => {
    const signal = snapshot.val();

    if (signal.type == "Buy") {
      buy(signal.pair, signal.userId);
    } else {
      sell(signal.pair, signal.userId);
    }

    database.ref(`users/${context.params.userId}/signals/${context.params.signalId}`).remove();
});
3
  • Are you sure the port is correct? The article says 9229 but according to this documentation the default port for functions is 5001
    – jfhr
    Commented Sep 21, 2022 at 14:08
  • if I change to 5001, it won't start when I click on 'Run'
    – GSeriousB
    Commented Sep 21, 2022 at 14:10
  • 2
    If you followed some steps, you should repeat them here in your post so we can follow along with your steps specifically. If you find an error or other unexpected behavior, your post should include that too so we can see what went wrong. "It's not working" isn't enough information to know how to help you. Commented Sep 21, 2022 at 15:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.