When I select 3 queries and run them in manual mode, there is no problem.
When I turn the same collection into Scheduled Run, I see that all posts have a 401 status code
I could not figure out the reason myself, help, ask questions
When I select 3 queries and run them in manual mode, there is no problem.
When I turn the same collection into Scheduled Run, I see that all posts have a 401 status code
I could not figure out the reason myself, help, ask questions
Hi @kartmun !
First, I want to welcome you to the community and also thank you for providing a video as this is super helpful for troubleshooting
Just to clarify, you’re only getting a 401 status code and no 403s?
A 401
status code indicates that authentication is required and the request has failed due to missing or invalid authentication credentials. If a single run in Postman works fine but a scheduled run returns a 401
error, there might be a few possible causes:
default
vs current
values for variables. Scheduled runs will use your default value.Hope this helps!
I understand the reason, I do not attach data for variables, but after applying it, I understand that all my dynamic variables turn into a poke and become static, how can I make it run as I do it manually?
Or is it fundamentally impossible?
If so, how then to prepare test data sets? To create in advance all id which will be “test”?
After researching the problem (Forums, Indian videos, official documentation).
I decided to analyze a detailed case, and I expect an answer on it (please).
So we have 4 requests:
In 2, 3, 4 we always pass X-XSRF-TOKEN in the header (I always use the variable in manual triggers)
In 3, 4 We use Bearer Authorization (I have it from the parent, also in the variable {{token}}
Now, to the point, I prepared a test bench With outputs from the console at different stages, ran it manually, through Sheduler and Postman CLI.
And I conclude that he does not use the variable {{x_xrsf_token}} in subsequent requests exactly at the level of the Variable, in the variable itself the value is correct, but there is no connection between {{x_xrsf_token}}
Thanks for the detailed explanation @kartmun. It helps a lot in understanding your issue. Let’s try to address this step by step.
x_xrsf_token
from the response.{{x_xrsf_token}}
. Also, capture the Bearer token in the test script section.newman run collection.json -e environment.json
.{{x_xrsf_token}}
as a literal string in the output, it indicates that the variable wasn’t available or set at that moment.It’s crucial to maintain a consistent variable state between manual and automated runs. If you still face challenges, I’d recommend breaking down your collection to simplify and isolate the issue.
hello @kevinc-postman
and how exactly does authorization work, when using scheduled runs? I have a fresh token for my collection I send requests to the same endpoint and URL’s are identical, in my environment all variables have equal initial and current values but I still got 401 error in scheduled run and 200 in manual.
I use authorizationCode flow of oauth2. If I do not have any pre-requested scripts ther would be no authorization at all?
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.