"I'm trying to view the body data in a Firebase Functions POST request, but the console always returns "undefined" in the Firebase function logs!
Question: How can I view the body data in a Firebase function to use it?
Here My Code :
exports.test = functions.https.onRequest(async (req, res) => {
const id = req.body.id
});
I allready used but not working :
req.on('data', (chunk) => {
// The chunk is a Buffer object containing a chunk of the request body data
body += chunk;
}).on('end', () => {
// The request body data has been fully received, and the `body` variable contains the complete request body
});
i should to get id from body.id