I need some help, My issue is my collections are running successfully in functional mode but same when i wan to run from CLI or Scheduled runs, my scripts are failing.
Its is giving "
[401 Unauthorized, 299B, 1809ms]
â
â âUnexpected response:â, { message: âUna
â uthorizedâ }"
I need some help here.
Thanks,
Anil
Below is the CLI cmd I am using
Last login: Sun Sep 29 22:54:46 on ttys002
â ~ postman login --with-api-key {{postman-api-key-here}}
postman collection run 34170092-ba14e4b2-16cb-4fc6-9330-f695abd79ff7 -e 34170092-2ecd3dd7-d2ad-42b8-b756-9bf5098e563f -i 34170092-9949f173-db4a-48f7-9823-656889e0e4a0 -i 34170092-52a4fd01-e109-4f9b-9eb8-2cefac9decdf
When i verified my URL it is showing âcom//cashâ a double â//â I think it is causing the issue,
How do i fix this?
Hey @lunar-module-operato
Which part of your Collection is setting the authorization for the requests? Are you running a script in a pre-request and store a variable?
Hi Danny,
Thank you for quick response,
We are passing Auth Type- bearerToken at Collection level and environment level, Yes we are running script in a pre-request and storing to variables.
thanks,
Anil.
Any suggestion @danny-dainton how to move forward
If youâre storing variables only in the current value, those are not synced and they wouldnât be seen outside of your Postman instance.
The CLI wouldnât be able to resolve the values as those are not available, they would need to be in the initial values for that to happen.
Variables set in a script during the execution of the Collection should carry through and will be used.
I donât know the full configuration of what you have in front of you or the scripts that youâre using.
Thank you @danny-dainton , let me set my variables and set them to the initial values and give a try.
Hi @danny-dainton , when i checked my variables in environment files , both Initial and Current values are having the same values.
Is there any other constraints? where my scripts are failing in scheduler and passed in functionally.
I do have few pre requisite scripts which set some of these Env values during run time.