This is my firebase cloud function. When user get's an error, it's not being readable.
exports.finishCheckoutPayment = functions.region('southamerica-east1').runWith({
timeoutSeconds: 60,
memory: '8GB',
}).https.onRequest((request, response) => {
functions.logger.log('request data', request.body)
cors(request, response, () => {
let headers = {
headers: {
'Content-Type': 'application/json',
access_token: 'my_api_token'
}
}
functions.logger.log('body asaas request', request.body)
axios.post('https://www.asaas.com/api/v3/payments', request.body, headers).then((data) => {
functions.logger.log('RESPONSE funcionando', data.data)
}).catch((error) => {
return response.status(400).send(error)
})
})
})
postman returns normal json error, while firebase return this shit without the important info.
What can i do to fix this error response ?!