Newman CLI Error - Invalid URI http:///Coach

Hi,
So basically I am moving my collections towards the newman CLI where as my collection contain .csv file and environment file.
When I run command with environment json file, NEWMAN CLI throwing error whereas without environment.json file, able to execute collection.

Step to reproduce:

  1. Export the collection.json and environment.json file.
  2. Get the .csv file data.
  3. Make sure node, npm, newman installed.
  4. run the newman command.
    newman run “collection.json file” -e “environment.json file” -d “.csv file”

Example: newman run “D:\Medifast APIs\newman.postman_collection.json” -e “D:\Medifast APIs\Dev.postman_environment.json” -d “D:\Medifast APIs\coachRankProgression.csv” OR

newman run newman.postman_collection.json -e Dev.postman_environment.json -d coachRankProgression.csv

Actual Value: Above command throwing error as Invalid URI "http:///Coach"
whereas without environment file, Able to run the collection.

Any solution?

Error:

Actual Value: Above command throwing error as Invalid URI “http:///Coach”

That URL is invalid in the collection.

No, URL is correct thats why working without the env. collection file.Means when URL is hardcoded without any env. variable, it"s working fine.

Actual URL(without env. variable): https://wq***/Coaches/Coach
Actual URL(with env. variable): {{coachRequestUrl}}/Coach
whereas coachRequestUrl=https://wq***/Coaches

I can see error message where as I can observe:

  1. It’s not underlying variable value inside the URL.
  2. And its taking http istead of “https”

So any suggestion beyond that?

Whatever value {{coachRequestURL}} is, it’s not resolving to that in the Newman run - So the URL is invalid. http:///Coach" is missing the part of the URL to make it valid.

Ensure that every change on the requests with the app is saved, the environment variables are at least in the initial value field before exporting, any value only in the current field will is not part of the file.

What does cat D:\Medifast APIs\Dev.postman_environment.json give you?

If it looks like this, the value is not there:

{
	"name": "Your Env Name",
	"values": [
		{
			"key": "coachRequestURL",
			"value": "",
			"enabled": true
		}
	]
}
1 Like