Kong / Kong/insomnia

Chaining requests do not work with CLI

Open
#6,059 1 comment 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

I have several endpoints to be tested, and some of them require authorisation. For all these endpoints, I configured the Bearer authentication with the token as a response body of the auth endpoint.

Example:
![Screenshot 2023-06-26 at 18 22 53](https://github.com/Kong/insomnia/assets/8030485/a3402c8a-4a62-4472-9e16-0608bc05654d)

![Screenshot 2023-06-26 at 18 27 45](https://github.com/Kong/insomnia/assets/8030485/e6180dd8-d9de-415b-ae77-7fd4b4761eaa)

### Actual Behavior

The request chaining works smoothly in the Desktop app. However, in the CLI, this just do not work whatsoever. No matter how the requests are configured, I always the the following error:

```sh
Error: Failed to render request: req_27dfd3974975476b8b784862b31b667a
at tryToInterpolateRequest (/snapshot/insomnia/packages/insomnia-send-request/dist/index.js)
at async Insomnia.sendRequest (/snapshot/insomnia/packages/insomnia-send-request/dist/index.js)
at async Insomnia.send (/snapshot/insomnia/packages/insomnia-testing/dist/run/insomnia.js)
at async Context. (/private/var/folders/v6/w38rpl2n1c3gkdh99s9tlxjm0000gn/T/insomnia-testing/0.5999570703761101-test.ts:79:22)
```

I already tried to use the tags in the environment, authorisation and headers, and all of them results in the same behaviour.

### Reproduction Steps

- Create a request that returns a token (or whatever data)
- Create another request that depends on the response of the first request
- Ensure it does work in Desktop app
- Run it with CLI and see it does not work

### 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

I also tried to run it in a pipeline (linux ubuntu 22.04.2 LTS), but it results in the very same problem.

### Insomnia Version

3.16.0

### What operating system are you using?

macOS

### Operating System Version

Apple M1 Max - Ventura 13.4.1 (22F82)

### Installation method

homebrew

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the CLI failure path at packages/insomnia-send-request/dist/index.js and packages/insomnia-testing/dist/run/insomnia.js, then reproduce the chained-request setup described in the issue. Done means a request using a response-body token renders and runs successfully in the CLI, matching Desktop behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.