Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

577
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda