pm.execution.setNextRequest is not a function CLI error

Last week, in the monitor console logs, I started seeing the warning “Using “postman.setNextRequest” is deprecated. Use “pm.execution.setNextRequest()” instead.”

Screen Shot 2024-04-15 at 14.29.44 PM

When running the tests through the monitors there are no issues using pm.execution.setNextRequest however if you run it through the CLI you get a type-error.

Screen Shot 2024-04-15 at 14.38.52 PM

I can’t find ANY documentation on pm.execution.setNextRequest() does anyone know anything about this?

Hey @descent-module-par12 :wave:

Welcome to the Postman Community! :postman:

That function will be deprecated soon and it will be moving under the pm.* of APIs. You’re fine to use that in the current version of Postman.

This will be coming to the CLI very soon but for now, I would use postman.setNextRequest() in your Collections.

1 Like

The pm.execution.setNextRequest() function works in the latest 1.9.0 version of the Postman CLI.