Hello
I am running into an issue where variables set in my Pre-request Script work fine during manual runs in the Postman app but fail to initialize properly when I trigger the same collection through Monitors.
Specifically; I am generating a dynamic timestamp & setting it as an environment variable but in monitor logs, it shows as undefined when referenced later in the request / in test scripts. ![]()
I have confirmed that the environment is correctly selected in the monitor settings & the script has no syntax errors.
Everything runs as expected locally but fails silently / returns unexpected values in the monitor context. I have tried adding logging & even reordering the scripts but with no luck so far. ![]()
Is there something different in how Monitors handle the execution context for pre-request scripts or variable scopes?
I checked Run API tests using Postman Monitors | Postman Docs guide related to this and found it quite informative. Since we are building a CI/CD pipeline around API testing; understanding what is devops helps highlight the importance of consistency between local & automated test runs something this monitor issue disrupts. ![]()
Would love to know if others have encountered similar behavior & whether there’s a reliable workaround, like initializing values differently / using global variables instead.
Thank you !! ![]()