Cannot import builtin module (node-fetch, axios)
I have checked the following:
- [X] I use the newest version of bruno.
- [X] I've searched existing issues and found nothing related to my issue.
Describe the bug
When importing "node-fetch" in my pre-request script, the return value is null.
I've tried adding node-fetch to the whitelist and installing node-fetch via npm in a package.json file in the same directory, but to no avail.
.bru file to reproduce the bug
const fetch = require('node-fetch')
console.log('pre-request script')
console.log(fetch) // null
bruno.json file:
{
"version": "1",
"name": "PaaS API",
"type": "collection",
"ignore": ["node_modules", ".git"],
"scripts": {
"moduleWhitelist": ["node-fetch", "axios"],
"filesystemAccess": {
"allow": true
}
}
}
Screenshots/Live demo link
Looks somewhat similar to what I reported in https://github.com/usebruno/bruno/issues/2907 Are you in safe mode, and does it work in developer mode?
@roband7 Unfortunately I am already using developer mode and the issue is still present.
I've got the same issue. Just installed newest version of bruno and when i'm trying to import axios, it returns null.
Also received null from any require made in Pre Request scripts. Switching to Safe Mode from Developer Mode gave me working imports.
Bruno v1.28.0
electron : 31.2.1
chrome : 126.0.6478.127
node : 20.15.0
v8 : 12.6.228.21-electron.
Also received
nullfrom anyrequiremade in Pre Request scripts. Switching toSafe ModefromDeveloper Modegave me working imports.Bruno v1.28.0 electron : 31.2.1 chrome : 126.0.6478.127 node : 20.15.0 v8 : 12.6.228.21-electron.
When I use Safe Mode I get the following error in the response panel:
Error invoking remote method 'send-http-request': Error: Error: Cannot find module node-fetch