pm.test(“Verify Status code is 200”, function () {
pm.response.to.have.status(200);
});
It throws 2 errors while the same script runs in a monitor
Failed: Verify Status code is 200
expected { Object (id, _details, …) } to have property ‘code’
I was unable to understand the full context, but from what I understood, looks like the place where things fail, the URL in questions is not reachable.
Do things work locally on your Postman app and fail on Monitor? Or is it the reverse?
Check the Postman console and provide a screenshot here, that would help people understand where and what is failing.
Console may be opened by clicking on the “Console” icon, located at the bottom left
Alternatively, you may open the Console Window by navigating to View → View Postman Console from the Postman app (native app only)
Thank you for the quick response. Things work fine in Postman app, Console doesn’t throw any errors, but they fail in Monitor. Console Log that can be viewed from Monitor throws the above error.
Hey @Chandana, thanks for sharing the screenshots that helps.
From this image, I understand that ptdinttest1 is a server running locally on your machine
localhost (127.0.0.1), as the name suggests, is local to your machine and not visible externally on the internet. And the reason why things work fine when running locally on the Postman app.
Postman Monitor will not be able to access your locally running server, and thus the failures that you see.
@Chandana your server needs to be externally accessible over the Internet for Postman Monitor to be able to reach it.
You can limit access to just Postman monitors by selecting and allowing Monitor’s static IPs on your Firewall/LB, if you are on the Business/Enterprise plan.