-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hi, i have an isuue with GF parsing attachment emails, i am not able even check if attachments was arrived, here is my nodejs function
app.post('', async function(req, res) {
try {
if (req.method === 'POST') {
const busboy = new Busboy({ headers: req.headers, limits: 50000000 });
const uploads = {};
const body = {};
busboy.on('field', (fieldname, val) => {
body[fieldname] = val;
});
const tmpdir = os.tmpdir();
const fileWrites = [];
busboy.on('file', (fieldname, file, filename) => {
const filepath = path.join(tmpdir, filename);
uploads[fieldname] = {
filename: filename || file.name || 'temp.temp',
filepath,
file,
};
const writeStream = fs.createWriteStream(filepath);
file.pipe(writeStream);
const promise = new Promise((resolve, reject) => {
file.on('end', () => {
writeStream.end();
});
writeStream.on('finish', resolve);
writeStream.on('error', reject);
});
fileWrites.push(promise);
});
busboy.on('finish', () => {
Promise.all(fileWrites).then(async () => {
try {
//uploads always are empty
} catch (e) {
console.log(e);
}
});
});
busboy.end(req.rawBody || req.body);
} else {
res.status(405).send({ error: 'ONLY POST' });
}
console.log('Start logging--', req.body);
} catch (e) {
console.log(e);
res.status(400).send(e.message || e);
}
});
Can you help to find out the issue?
Metadata
Metadata
Assignees
Labels
No labels