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

318
Visualizações
Failed to evaluate transaction: TypeError: Cannot read properties of undefined (reading 'toString') reactJS

frontend code reactJS:

await axios
.put("http://localhost:8080/api/updateBudget/"+gmail, bud)
.then((response) => {
  console.log(response);
})
.catch((error) => {
  if (error.response) {
    console.log(error.response);
    console.log("server responded");
  } else if (error.request) {
    console.log("network error");
  } else {
    console.log(error);
  }
});

Backend code NodeJS:

app.put('/api/updateBudget/:gmail', async function (req, res) {
    try {
    const ccpPath = path.resolve(__dirname, '..', 'dev','fabric-samples','test-network', 'organizations', 'peerOrganizations', 'org1.example.com', 'connection-org1.json');
    const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8'));
     
    const walletPath = path.join(process.cwd(), 'wallet');
    const wallet = await Wallets.newFileSystemWallet(walletPath);
    console.log(`Wallet path: ${walletPath}`);
     
    const identity = await wallet.get('appUser');
    if (!identity) {
    console.log('An identity for the user "appUser" does not exist in the wallet');
    console.log('Run the registerUser.js application before retrying');
    return;
    }
     
    const gateway = new Gateway();
    await gateway.connect(ccp, { wallet, identity: 'appUser', discovery: { enabled: true, asLocalhost: true } });
     
    const network = await gateway.getNetwork('testchannel');
     
    const contract = network.getContract('supply_chain');
     

     
    await contract.submitTransaction('updateBudget',req.body.gmail,req.body.bud);
    console.log('Transaction has been submitted');
    res.send('Transaction has been submitted');
     
    await gateway.disconnect();
     
    } catch (error) {
    console.error(`Failed to evaluate transaction: ${error}`);
    process.exit(1);
    }
    });

i am getting network error in console and typeError in terminal whenver i hit the api. In frontend i have used ReactJS and in backend i have used NodeJS and i am storing data in blockchain.

about 4 years ago · Santiago Gelvez
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