I was using some external library in a pre-request script like so :
pm.sendRequest(`https://unpkg.com/[email protected]/dist/xlsx.full.min.js`, (err, res) => {
eval(res.text());
// now using lib
var wb = XLSX.utils.book_new();
// ...
})
Worked nicely (I think I recently allowed postman update), but now it fails with “TypeError: Cannot set property ‘JSZipSync’ of undefined”
I searched for the cause in the loaded script and found that the zip lib included in the js script try to set the JSZipSync of either window, self, global, globalThis or $.global so that it can be found by consuming code of XLSX.
So probably one of them was defined before in postman environment, it si no longer the case.
Do you have similar issue ? And maybe a trick to work around this ?
This definition of window allow the jszip lib to properly attach on window, avoiding the error, but XLSX lib later seem to fail using it, silently producing invalid xlsx file. I need to investigate further.