Kong / Kong/insomnia

Insomnia cli --env-var option not working as expected

Open
#8,779 0 comments 0 reactions 0 assignees View on GitHub
B-bug S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

Insomnias cli **--env-var** doesn't work with the v 11.1.0-beta 0 and up.
When using the option in the terminal it doesnt update the environment variable. I keep the value, if set, from the yaml exported collection.

### Actual Behavior

**--env-var** should change the value of the given environment variable

### Reproduction Steps

1. Create a quick request pointing to any endpoint
2. Make an environment variable called "**ENV**"
4. in pre-request script put console log of the said env from insomnia.environments
5. export the collection
6. Run the collection in terminal using the cli
`inso run collection -w --env-var "ENV=changed" --verbose`

### Is there an existing issue for this?

- [x] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Which sync method do you use?

- [ ] Git sync.
- [ ] Insomnia Cloud sync.
- [x] Local only

### Additional Information

It seems like it skips checks for the --env-var and it continues as it wasn't there.
Even latest beta of 11.2.0 has the same issue

### Insomnia Version

11.1.0-beta 0 to 11.1.0

### What operating system are you using?

Windows

### Operating System Version

Windows 11 23H2, latest

### Installation method

Downloaded insomnia from releases page

### Last Known Working Insomnia version

unknown

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with `inso run collection -w --env-var "ENV=changed" --verbose` on Windows, focusing on the CLI's `--env-var` handling. Trace how the exported collection and pre-request script access the environment, then verify that the script logs `changed` instead of the YAML value.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.