Why does Docker complain about promise exception on a express server?It seems like I can run this fine on my local machine, but on docker, I'm getting an error likeUnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefinedconst express = require('express'); const router = express.Router(); const axios = require('axios'); router.get('/', (req, res) => { try { axios.post(`http://localhost:1111/get`, null, { }) .then((response) => { console.log("Success"); }) .catch(function (error) { // Do Something // console.log(error.response.data.error_description); }); } });
Submitted July 20, 2020 at 10:25AM by exilen
No comments:
Post a Comment