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

576
Views
Send a POST request by axios with firebase functions

I am trying to send a POST request via axios andfirebase cloud function while the body of the request in axios contains data from changes occured in realtime db using the functions but everytime I deploy my code I get the error:

Function failed on loading user code. This is likely due to a bug in the user code. 
Error message: Error: please examine your function logs to see the error cause: 
https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional 
troubleshooting documentation can be found at 
https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit 
https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting 
documentation.

I am quite new to firebase functions so I really don't know what I am doing here even after having some research. Code:

const functions = require("firebase-functions");
const axios = require("axios");



exports.newNodeDetected = functions.database
    .ref("Orders/{userId}/{customerId}/{ordernum}/customername")
    .onCreate((snapchot, context) => {
      const order = snapchot.val();
      const userId = context.params.userId;
      console.log(userId + "AND CUS NAME IS" + order);

      axios.post("http://something.com/data.php", {
        username: userId,
        title: "ttl",
        message: "msg",
      })
          .then(function(response) {
            console.log(response);
          })
          .catch(function(error) {
            console.log(error);
          });
    });
about 4 years ago · Juan Pablo Isaza
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!