insomnia
insomnia copied to clipboard
Request link lost from response function when exporting and re importing
Expected Behavior
If I have a request set up that uses a response function to get a value from the body of another response I expect that if I export and re import the function the request link should remain.
Actual Behavior
After exporting and re importing my request the request link cannot be found even though it is present in the json file that is exported.
Reproduction Steps
Create a GQL request Created response function as part of Bearer auth Export the entire project as insomnia V4 (json) Delete the project and re import the json file Inside the response function the request value is blank and an error message is shown "Could not find request"
Is there an existing issue for this?
- [X] I have searched the issue tracker for this problem.
Additional Information
No response
Insomnia Version
2023.2.0
What operating system are you using?
macOS
Operating System Version
macOS Monterey
Installation method
Brew
Last Known Working Insomnia version
This worked in the previous version I had I assume 2023.1.0
Yes, I noticed this too. This can be very frustrating if you have a lot of environment variables and you need to set them all again after re-importing.
Notice: I think this bug occurs because the request (e.g. with id req_4b9ffe87e75f4ce2a476f9cddd3d541d
) that is connected with the environment variable, does not exist anymore because it was deleted.
That means if you don't delete the insomnia collection before importing the json file (having two collections then), the environment variables work because the connected request is still there in the other collection that you didn't delete.
Currently I see the following solutions that could solve this:
- Import the requests with the id specified in the json and don't create a new id when creating a request. Then the environment variables would be connected correctly to the request. This would have the disadvantage that you can't import a collection without deleting the one you exported before, because the id of the requests can't be the same.
- Change the export mechanism so the environment variables are not connected to the request via the request id but via another identifier?
- When importing, somehow set the request id of the environment variables to the newly created request id.
- See what has changed from the previous insomnia version, where this worked?
The same issue happens for me in test suites on a Windows 10 host.
I have a unit test which references a request by id in the JS code const response = await insomnia.send('req_436bfb93833b4cfd9ea188c1123076e3');
. When I export->delete->import the document, this request, which are linked by id, will fail with failed to find request
.
Seems like this is the same as the problem reported in https://github.com/Kong/insomnia/issues/5942. Export/Import of request chains is pretty broken at the moment.
Closing as duplicate of https://github.com/Kong/insomnia/issues/5730