Unable to have multiple environments with same variable names
- Dominant language
- TypeScript
- Stars
- 40k
- Forks
- 2.4k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
### Expected Behavior
We should be able to reuse variable names with different values in different environments.
### Actual Behavior
If you create two environments and the two have identical variable names you cannot use the variables in a request chain.
In our case we're using request chaining to obtain OAuth tokens. We have many different applications and each has their own set of credentials. So we usually have a client, secret, and scope for each application. We can setup the request chain for the first application, but when we try to create a second chain whenever we save the Edit Tag form the settings are not saved.
### Reproduction Steps
1. Create a query to obtain a token if you don't already have one
2. Create a new environment
3. Add two variables that are strings (Id/Pw or something) and a variable to hold the token
4. Configure the token var to pull from a response body of of the token request
5. Create a new environment and repeat steps 1-4
6. Note that you cannot save the second request chain mapping
I have tried both using the same auth query in step #1 and creating a new HTTP request to obtain the token and neither work.
I opened the dev tools and saw these errors:
When saving the Edit Tag modal:
```
12:49:51.060 › Error rendering template Template render error: (unknown path)
Error: No request specified
at Object._prettifyError (/Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:113:11)
at /Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:2743:19
at eval (eval at _compile (/Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:2806:18), :10:11)
at file:///Applications/Insomnia.app/Contents/Resources/app.asar/index-391c2d16.js:90:19130
helpers.ts:98 12:49:51.060 › Failed to render element Environment {% response 'body', '', '', 'never', 60 %}
```
And after opening the Edit Tag modal again:
```
12:50:27.515 › Error rendering template Template render error: (unknown path)
Error: No request specified
at Object._prettifyError (/Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:113:11)
at /Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:2743:19
at eval (eval at _compile (/Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:2806:18), :10:11)
at file:///Applications/Insomnia.app/Contents/Resources/app.asar/index-391c2d16.js:90:19130
helpers.ts:98 12:50:27.516 › Failed to render element Environment {% response 'body', '', '', 'never', 60 %}
helpers.ts:98 12:50:27.518 › Error rendering template Template render error: (unknown path)
Error: No request specified
at Object._prettifyError (/Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:113:11)
at /Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:2743:19
at eval (eval at _compile (/Applications/Insomnia.app/Contents/Resources/app.asar/node_modules/nunjucks/browser/nunjucks.js:2806:18), :10:11)
at file:///Applications/Insomnia.app/Contents/Resources/app.asar/index-391c2d16.js:90:19130
helpers.ts:98 12:50:27.518 › Failed to render element {% response 'body', '', '', 'never', 60 %}
```
### Is there an existing issue for this?
- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.
### Additional Information
At least two other people in our company is having the same issue.
Full Insomnia info:
Version: Insomnia 2023.5.6
Build date: 8/22/2023
OS: Darwin x64 22.4.0
Electron: 25.2.0
Node: 18.15.0
Node ABI: 116
V8: 11.4.183.23-electron.0
Architecture: x64
### Insomnia Version
2023.5.6
### What operating system are you using?
Other (specify below)
### Operating System Version
Happens on Mac and Windows
### Installation method
downloaded
### Last Known Working Insomnia version
A week or two ago (I've gotten several updates these past couple weeks)
Contributor guide
Research direction
Reproduce the failure with two environments and identical variable names, then inspect the Edit Tag modal and the environment request-chain mapping flow. Start with helpers.ts and the reported failed rendering path, and compare behavior when saving and reopening the second mapping. Done means both chains save successfully and each environment resolves its own variables without the “No request specified” error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100