Why Environment variable doesn't update in postman flow?
Asked Answered
L

1

8

When I am calling an api with normal api calling in postman and running a test script and setting environment value, it's working but when I use that api in postman flow, environment doesn't changing.

Script in my test: pm.environment.set('email', body.email)

Lorraine answered 14/2, 2022 at 14:5 Comment(2)
Do you see any error in this scenario?Does the value actually gets retrieved to be stored in the environment var?Eliathan
no error, even in the test script after setting the value I console.log the value and it's showing the updated value but in the environment there is still old value. I checked with a simple single flow to make assure that there is no overwrite process.Lorraine
C
6

Looks like you are looking for this issue from discussions section of Postman Flows repository: https://github.com/postmanlabs/postman-flows/discussions/142. Here are some key points from it:

I want to begin by saying that nothing is wrong with environments or variables. They just work differently in Flows from how they used to work in the Collection Runner or the Request Tab.

Variables are not first-class citizens in Flows.

It was a difficult decision to break the existing pattern, but we firmly believe this is a necessary change as it would simplify problems for both us and users.

Environment works in a read-only mode, updates to the environment from scripts are not respected.

Also in this post they suggest:

We encourage using the connection to pipe data from one block to another, rather than using Globals/Environments, etc.

According to this post:

We do not supporting updating globals and environment using flows.

Claudineclaudio answered 30/5, 2022 at 11:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.