SetNextRequest fails in Azure pipeline run

Runs all good in local but when merged to azure and collection json fails and following error displayed

Hey @kiranpati1234 :wave:t2:

Welcome to the Postman Community :postman:

What’s the script that you have in the post response section that references that function?

What version of Newman is the pipeline using?

Thanks Danny.

This is setup in postman which runs the collection in postman but when i export and run in azure its fails

This the collectionJson screenshot

newman verison
image

That’s not the Newman version, that’s the version of something else that internally using a version of the Newman package.

Has this worked previously? How are you referencing the Collection in the run command?

Sorry got the vesrion “newman”: “^5.3.2”,

yes we are running the collection.json in azure cli and its working but now we added setNextRequest and moved data setup at one place and all collections having Pre-Requisite Data Run folder .
When i run collection in postman its calls Pre-Requisite Data Run folder and than in last TC i have called it back to RequestName setup in TC-01 …
running flow in postman:
Tc-01
1.1
(Pre-Requist Data Setfolder is started) A
B.
… After G i have set return to RequestName setup in 1.1 so
1.2 is executed… and than goes to TC-02
but when i run in in Azure CLI it goes
1.1 and gives error (Cannot read properties of undefined (reading ‘setNextRequest’)
1.2
1.3…

When it says cannot read the properties of undefined like that, the problem isn’t usually with that function (in this case setNextRequest) but the method just before it. So the issue is that is doesn’t like pm.exectution.

pm.execution is a new method so its possible that you are using an older version of Newman that used the “postman.setNextRequest” method instead.

The first recommendation would be to ensure you are running the last version of Newman (which you aren’t, the latest version is 6.1.3).

Make sure the version of node you use in the pipline is also up-to-date.

Thanks @michaelderekjones and @danny-dainton After updating my local dependencies with npx npm-check-updates -u and merged the code back it worked as expected :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.