TypeError: pm.setNextRequest is not a function


#1

This is my only line in my test script, it is giving me TypeError: pm.setNextRequest is not a function … Why is this happening? v6.7.2

pm.setNextRequest('MyRequest');


#2

The pm.* api doesn’t have that feature yet. I would try postman.setNextRequest() instead.


#3

Thanks. Ah. I was looking at harryi3t here - https://github.com/postmanlabs/postman-app-support/issues/4193 , where he uses pm.

Changed it to postman and now I’m not getting an error but it’s not working either. Hmm.

I get the message logged to console here but the next request does not fire.

if (pm.globals.get("bearerToken")===null || pm.globals.get("bearerToken")==='') 
{
    console.log('bearerToken is null or empty. fetching....');
    postman.setNextRequest('GetToken');
    pm.variables.set('goto', 'MyRequest');
}

#4

Oops I was running it by itself not the folder/collection (collection runner), working now. Thanks again.