Kong / insomnia

The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
https://insomnia.rest
Apache License 2.0
35.04k stars 1.99k forks source link

Unable to save updates in environment variables #6372

Open goofy78270 opened 1 year ago

goofy78270 commented 1 year ago

Expected Behavior

Looking to have the UI save updates made in the environment variable setups

Actual Behavior

Recently, we have been facing issues where updates to our environment variables, either manually entered values or path values of responses, are not saved after update and exit. I have read about the previous issues around pasting values, but this is simply updating text and saving, that is not working.

Reproduction Steps

Access an existing environment variable using built-in tools, such as cookie lookup, or response -> body attribute Update the lookup value Close Update screen Close Manage Environments screen Re-open Manage Environments screen Re-open Environment contain previous variable (should be same as previous - since env was not changed) Re-open built-in tool variable settings Verify change (in this case, update was not kept)

Is there an existing issue for this?

Additional Information

Would be happy to share screen in a review session if desired.

We do have 40+ environments setup with values set in our Base Environment as well as test specific folders, so unsure if the count of env variables could contribute to the issue.

Insomnia Version

2023.4.0

What operating system are you using?

macOS

Operating System Version

Build date: 7/4/2023 OS: Darwin x64 22.6.0 Electron: 23.3.9 Node: 18.12.1 V8: 11.0.226.20-electron.0 Architecture: x64

Installation method

Download from Insomnia

Last Known Working Insomnia version

No response

Alek-S commented 1 year ago

noticed after the most recent update, that my variables are not applying. Likewise doesn't seem to switch between environments.

joltman61 commented 1 year ago

Seeing the same issue on sub environment. After editing tag looking for a response body attribute, the live preview value is updated and correct. After closing the edit tag dialog, the changes seem to be reverted. I tried to add a simple static attribute {"test": "1"} to the same sub environment and it too was not persisted. I edited the base environment similarly with this static attribute and it was persisted.

Insomnia Version 2023.5.6 Operating System Version OS: Windows_NT x64 10.0.19045

roffelsaurus commented 1 year ago

Folder environments are not consistently applying changes. In about 1/10 of attempts it seemed to have persisted the changes at a later time. Smells like some fancy async persistence not working.

It is also not possible to remove folder environments already set. This means that it is not possible to use this tool for authenticated requests imported from Postman without changing variable names.

Bad timing to have such a show stopping bug right before the competition will perform a rug pull(Postman not having free collections anymore).

mikebridge commented 1 year ago

I am only able to save changes to environment variables by closing the edit window, then closing insomnia entirely, then starting it again.

Version: Insomnia 2023.5.7
Build date: 2023-08-30
OS: Linux x64 6.4.7-surface
Electron: 25.2.0
Node: 18.15.0
Node ABI: 116
V8: 11.4.183.23-electron.0
Architecture: x64
bil-mason-kr commented 1 year ago

I have the same problem as @mikebridge

Version: Insomnia 2023.5.8
Build date: 9/7/2023
OS: Darwin arm64 22.6.0
Electron: 25.2.0
Node: 18.15.0
Node ABI: 116
V8: 11.4.183.23-electron.0
Architecture: arm64
lcsmobileqa commented 1 year ago

I am also having this problem. Version: 2023.5.8 Build Date: 9/7/2023 OS: Windows_NT x64 10.0.22621 Electron: 25.2.0 Node: 18.15.0 Node ABI: 116 V8: 11.4.183.23-electron.0 Architecture: x64

code-surfer commented 1 year ago

Some here. I want to have a "Response => Body Attribute" in a sub environment. Edit Tag, click Done, Close results in the tag losing its configuration. Edit Tag, click Done, edit something else in the JSON, Close results in the tag being saved as well. I got the idea for this work-around in #2383.

Version: Insomnia 2023.3.0 Build date: 6/27/2023 OS: Linux x64 5.10.0-23-amd64 Electron: 22.3.11 Node: 16.17.1 V8: 10.8.168.25-electron.0 Architecture: x64

I'm using this old version because it's the last one that runs on Debian 11.

siarhei-kavaleuski commented 1 year ago

In my case I can't save env variables by pressing the Close button, only thing which helps me is switching environment while env variables view is open. After switching and closing it works...

pjloomis commented 1 year ago

Experiencing the same problem. Base or sub environment variables doe not save as expected. This includes Edit Tags.

rellampec commented 1 year ago

Same here

Version

Version: Insomnia 2023.5.8
Build date: 8/09/2023
OS: Windows_NT x64 10.0.22621
Electron: 25.2.0
Node: 18.15.0
Node ABI: 116
V8: 11.4.183.23-electron.0
Architecture: x64

The Context

The problem seems to happen in a specific set-up where there are cross-dependencies between Base Environment and specific environments (i.e. Prod), where queries (and other stuff) use env vars NOT defined in the Base Environment but only on the specific environments.

In this context, when editing Base Environment (from the Manage Environments window), the specific environment gets unselected. Closing Manage Environments window, triggers your queries (or your active query) to fetch (lookup) the env vars (used for example in the url), which obviously errors and unexpectedly prevents Insomnia from saving your changes (possible bug).

(suggested minimal recreation further down)

A work around

I would dare to say that to work-around the problem:

  1. At the top left, make sure you got one specific environment selected from the dropdown, other than Base Environment
  2. Click the cogwheel next to it to see the Manage Environments popup (at this stage the particular enviro is still selected)
  3. Click now on Base Environment and do some change.
  4. If you click Close now, if you got env-vars used in queries that are not in the Base Environment, you will lose your changes, because of the error that looks-up through cross-dependencies.
  5. Rather than closing, with the Manage Environments still open, select on the left list your target specific environment.
  6. Now you can click Close. If there were NO errors coming from your change (no red references within your env vars), you should get your changes SAVEd (or at least, that's what I see).

Possible recreation (not tested)

Basic Environment (must miss host env var)

{
  "end_point": "apiv3"
}

PROD sub env:

{ 
  "host": "https://prod.tld/_.end_point"
}

Query Sample

Now you build a GET query called List Users where the url is: _.host/users . This ensures there's a dependency on an env var NOT present in Basic Environment (but only in PROD).

Recreating

  1. Create the basic set-up above
  2. Once done, select PROD, next click cogwheel to Manage Environments
  3. Select Basic Environment and add alongside end_point a var called response that retrieves from some other's query result
  4. Before clicking on Close, make sure your new var doesn't show in red.
  5. Click Close
  6. See how your query shows the url in red
  7. Open again Manage Variables and see how your changes were not saved.
Ordiel commented 11 months ago

After lots of frustration trying to get my environments to look as I wanted to (a mix of my envs and folder envs) I noticed that apparently this must be getting cached somewhere if I do edits to my envs and then I re-open them just to check the previous updates I did I was not seeing them, yet if after I updated them I closed the app then open the app again and then see the environments they are properly updated, this is nonetheless quite an annoying and unexpected behavior yet I also don't expect folks to be modifying their envs that often so hopefully this helps others to get over this and it also helps devs to resolve this sooner

LunaticoCR commented 11 months ago

This is super annoying and basic. The only way I've found to save changes to environment variables is by closing the app right after applying changes and when I reopen it they're there. Anyone from Insomnia reading this?

Dec-18-2023 16-43-50

LunaticoCR commented 8 months ago

Update: I seems like this issue got fixed on one of the recent updates? I can now modify env variables without having to restart the app each time etc...

corebreaker commented 8 months ago

Not me, the save has not been done. If we follow the same scenario (or other described) even if i restart the app, no save. Sometimes, it saves variable when i try many times but it seems working randomly.

jaguarxii commented 4 months ago

as a workaround I found that after editing a "smart variables" (one that comes from another request) I edit/create a "dummy" variable with a constant value.

image