-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts: Not able to import external packages #138
Comments
Hi @DivyMohan14 ! Glad that you like Bruno! The reason for using The long term plan is to give more flexibility for the user to turn off the For the short term, I feel we can give access to some core nodejs modules inside the sandbox by default. Can you take this up @DivyMohan14 and raise a PR ? There is a problem that you might run into. The pre-request script works fine with synchronous code, but I don't think it yet handles asynchronous code like |
I spent some time on this today. Added some node core modules to the sandbox. I also plan to expose Here is the PR that is tracking this work: https://github.com/usebruno/bruno/pull/139/files Currently struggling with making async await work in |
Yeah was working on this as well, same thing So I thought if this is not fully supported will shift to some sync request libraries like sync-request |
@DivyMohan14 Thanks for taking time and making async scripting work ! |
@DivyMohan14 Would you mind posting your resulting access-token pre-request script here for posterity? |
Really like the way
bruno
has been structured. Will be looking forward to make this my daily driver for api integrations and testingIssue Summary:
Goal: Wanted to write a Pre Request script which will hit a Login Api get the
auth token
in the response and will then set the request header (Bearer token
) in the request header for the current api.Steps Taken
node-fetch
lib.Issue Faced: I got this error as soon as I ran the script .
Cannot find module 'stream'
(node-fetch internally uses Stream module )Possible Issue:
bruno
locally. Looking at the code, looks likebruno
internally utilises vm2 module to run the script in a separate container.'sandbox'
, changing it to'host'
or removing it (both of which are the same) resolved the issue for me.Machine:
Also saw one comment related to this on vm2
Wanted to understand why did we use 'sandbox' in the context in
bruno
?Will be happy to pick it up, and solve it.
The text was updated successfully, but these errors were encountered: