Thanks a lot!

For anyone who want to try it on firebase

import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' admin.initializeApp() import * as express from 'express' import * as path from 'path' import * as jsreport from 'jsreport-client' const app = express() const jsreportAdmin = functions.config().jsreport.admin; const jsreportPassword = functions.config().jsreport.password; const client = new jsreport('https://xxxxx.jsreportonline.net/', jsreportAdmin, jsreportPassword); const generatePdf = async () => { const response = await client.render({ template: { shortid: 'xxxxx' }, data: { name: 'dasdasd'}, }) const metadata = { contentType: 'application/pdf' }; const bucket = admin.storage().bucket(); const fileName = `test.pdf`; const filePath = path.join(path.dirname('/test'), fileName); // Create upload stream const uploadStream = bucket.file(filePath).createWriteStream({metadata}); response.pipe(uploadStream); return new Promise((resolve, reject) => uploadStream.on('finish', resolve).on('error', reject)); } app.get('/generate', async (req, res) => { try { await generatePdf(); return res.status(200).json({}); } catch (error) { console.error(error); return res.sendStatus(500); } }); exports.app = functions.https.onRequest(app);