Skip to content
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

eval cannot access variables #4387

Open
2 of 4 tasks
rsuplido opened this issue Apr 1, 2025 · 3 comments
Open
2 of 4 tasks

eval cannot access variables #4387

rsuplido opened this issue Apr 1, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@rsuplido
Copy link

rsuplido commented Apr 1, 2025

I have checked the following:

  • I have searched existing issues and found nothing related to my issue.

This bug is:

  • making Bruno unusable for me
  • slowing me down but I'm able to continue working
  • annoying

Bruno version

2.0.1

Operating System

Windows 11, MacOS

Describe the bug

Bruno's eval() can't seem to evaluate existing variables. In Postman, this works:

let lHello = "world";
console.log(lHello);
eval('test={"hello":lHello}');
console.log(test);

In Bruno, it will come back with "lHello is not defined".

I simplified the code to show the issue. I was trying to convert a Postman script by dynamically changing req.body (pm.request.body.raw in Postman) but Bruno can't seem access variables from within eval().

.bru file to reproduce the bug

No response

Screenshots/Live demo link

Bruno:
Image

Postman:
Image

@rsuplido rsuplido added the bug Something isn't working label Apr 1, 2025
@sreelakshmi-bruno sreelakshmi-bruno self-assigned this Apr 1, 2025
@sreelakshmi-bruno
Copy link
Collaborator

Hi @rsuplido, i was able to reproduce this issue in developer mode but it works in safe mode, can you try switching to safe mode and confirm if it's working for you. There seem to be a problem with using variables inside eval() in dev mode. We'll look into it. Thanks!

@rsuplido
Copy link
Author

rsuplido commented Apr 1, 2025

Thanks for investigating @sreelakshmi-bruno.

It does look like it works on Safe Mode, even on v1.39.1. Will keep testing.

@rsuplido rsuplido closed this as completed Apr 1, 2025
@rsuplido
Copy link
Author

rsuplido commented Apr 1, 2025

mistakenly hit closed. reopening.

@rsuplido rsuplido reopened this Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants