bruno: Regression: Environment Variables Values Not Working Since v1.18.0
I have checked the following:
- I use the newest version of bruno.
- I’ve searched existing issues and found nothing related to my issue.
Describe the bug
Since updating to version 1.18.0, environment variables used within the values of other environment variables no longer work as expected. This feature was available and worked correctly since version 1.17.0.
Setup
Let’s take a GET request at https://catfact.ninja/fact that retrieves random cat facts via text message every day :
You can see that the URL is a variable, which comes from the environment variables as shown here :
As you can see,
url is also made up of another environment variable Cat.
.bru file to reproduce the bug
environements/Local.bru
vars {
Cat: https://catfact.ninja
url: {{Cat}}/fact
}
cat.bru
meta {
name: cat
type: http
seq: 3
}
get {
url: {{url}}
body: none
auth: none
}
Screenshots/Live demo link
Versions before v1.17.0
I would get an error :
Version v1.17.0
I would get a 200 OK with the wanted response :
Version 1.18.0
But since the 1.18.0 update, I get the same error as I did before version 1.17.0:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 15
Does not work with 1.20.1. On top of that, declaring something as collection var just to make it work (if it actually did) is not the right approach IMO. Even when I move the script to collection pre-request script section, I see my token using getVar in the dev console but Collection variables do not show this programmatically defined variable and it is also unavailable (red font) in the auth bearer token input field using {{auth_token}}. Broken.
I’ll have to stick with Insomnia which even has nice built-in dialogue for these response variables. I do not mind defining things programmatically but it seems completely broken to me.
Hey @Peperomain
sure, here’s a simple script that’l create a equivalent collection var with the interpolated env var value.
You can add this in the collection level pre-request script. And since the collection variables hold higher precedence over env vars, interpolated values will be used.
https://github.com/usebruno/bruno/assets/159901171/a781c6ac-1b81-413d-980d-ddb38ab5001b
this issue is not fixed in v20. if you execute the collection i posted, the problem still exists. i’ve just created a new bug issue.
@Peperomain
The fix in v1.17.0 was incidental and not a proper one.
For example:

The above scenario doesn’t work in v1.17.0 either.
To properly solve this, multi-level interpolation needs to be done.
I do plan on working on this if time permits and based on my other task priorities.
This issue can be overcome through scripting. Do let me know if you need any help with it.