@testmonger From the result of your code snippet, I can see that the response returned is null. Could you confirm the conditions under which your API returns such a response? Also, could you share the results of console.log(pm.response.json()); across the app and Newman?
@kunagpal Finally found a solution, related to authorization and environment variables. The environment variables used for authorization were working fine in postman, but required extra care when trying to access from newman.
(1) While running newman, I found it more reliable to specify the collection and environment as local json files rather than URLs. Example:
Use this in the newman shell script:
PMCOL=AUTO_XXX.postman_collection.json
PMENV=AUTO_XXX.postman_environment.json
(2) I need oauth credentials for some of the requests. But for the AWS elastic search requests (which are also included in the same collection), I had to include an additional parameter in the newman call: --insecure
So, the complete newman call that is successfully running for me looks like this: