# Getaddrinfo ENOTFOUND {{host}}{{version}} revisited

**URL:** <https://community.postman.com/t/getaddrinfo-enotfound-host-version-revisited/17407>\
**Category:** Help Hub\
**Created:** [November 4, 2020, 1:58pm UTC](https://community.postman.com/t/getaddrinfo-enotfound-host-version-revisited/17407 "2020-11-04T13:58:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robmcec](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/robmcec/32/5857_2.png) [@robmcec](https://community.postman.com/u/robmcec)\
**Post date:** [November 4, 2020, 1:58pm UTC](https://community.postman.com/t/getaddrinfo-enotfound-host-version-revisited/17407/1 "2020-11-04T13:58:09Z")

</div>

Here’s my script. Well, at least the important part.

```
require('dotenv').config();
const { Console } = require('console');
const newman = require('newman'); // require newman in your project
const key = process.env.postman_api_key;

// The signature for the run function is newman.run(options: object , callback: function) => run: 
EventEmitter
newman.run(
{
    //collection: require('.\\Orders_1.postman_collection.json'),
	collection: 'https://api.getpostman.com/collections/13204628-74a6e824-c8d1-45fd-83e8-8a9003304b37?apikey=' + key,
    environment: require('.\\localHost.postman_environment.json'),
    //environment: 'https://api.getpostman.com/environments/12415606-e03e06c1-00f4-422a-891a-4e6984aa7cf3?apikey=' + key,
	reporters: 'htmlextra', // htmlextra is a reporting package for newman that will require installlation using NPM.
    reporter: 
	{ //Go here for documentation: https://www.npmjs.com/package/newman-reporter-htmlextra
		htmlextra: //Report options
		{
			export: '.\\Results.html', //Directory and name
			template: '.\\InnovaAPITemplate.hbs', //Template used for report. Html, CSS and JS are all embedded.
			title: 'Innovations API',
			showEnviornmentData: true,
			browserTitle: "Innovations API",
			showMarkdownLinks: true,                
			showFolderDescription: true,
            //skipSensitiveData: true //Hides request header because it can contain the authorization tokens.               
		}
	}
},// <-- End of options object
function (err,summary)// <-- Beginning of callback function

```

…other stuff

From prior posts, it seems I cannot retrieve environment variables using the postman api using the newman library. Therefore I cannot use the jwt token in the environment.

So I export my environment json, which still doesn’t have the jwt token because we don’t want to save that as an initial value in the enviornment. To fix this I manually copy and pasted the jwt token into the environment json (“value” : “key”)

I try to run the collection and everything fails with the error:  
**getaddrinfo ENOTFOUND {{host}}{{version}}**

I guess my first question is “Is this even the best way to do this?”  
The second question being “Why doesn’t this work?”

-Thanks

P.S. How do I get the code snippet to format correctly? I push the \</\> button, then it puts this in the post  
indent preformatted text by 4 spaces  
Then when I paste my code, it doesn’t indent the code. Maybe the first line.  
The only solution I’ve been able to figure out is that I have to go through my code example line by line and manually indent it. Any suggestions?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 4, 2020, 5:44pm UTC](https://community.postman.com/t/getaddrinfo-enotfound-host-version-revisited/17407/2 "2020-11-04T17:44:55Z")

</div>

For the code render issue - Just copy the formatted code here and then add 3 backticks (```) to the line in front and the line after. 😄

I’m about to head off but I’ve added a reminded to take a look at this and your other question when I get back online tomorrow.

---

<div class="post-metadata">

**Author:** ![robmcec](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/robmcec/32/5857_2.png) [@robmcec](https://community.postman.com/u/robmcec)\
**Post date:** [November 4, 2020, 6:19pm UTC](https://community.postman.com/t/getaddrinfo-enotfound-host-version-revisited/17407/3 "2020-11-04T18:19:27Z")

</div>

Test

```auto
require('dotenv').config();

const { Console } = require('console');

const newman = require('newman'); // require newman in your project

const key = process.env.postman_api_key;

// The signature for the run function is newman.run(options: object , callback: function) => run: EventEmitter

newman.run(

    {

        //collection: require('.\\Orders_1.postman_collection.json'),

        collection: 'https://api.getpostman.com/collections/13204628-74a6e824-c8d1-45fd-83e8-8a9003304b37?apikey=' + key,

        environment: require('.\\localHost.postman_environment.json'),

        //environment: 'https://api.getpostman.com/environments/12415606-e03e06c1-00f4-422a-891a-4e6984aa7cf3?apikey=' + key,

        reporters: 'htmlextra', // htmlextra is a reporting package for newman that will require installlation using NPM.

        reporter: 

        { //Go here for documentation: https://www.npmjs.com/package/newman-reporter-htmlextra

            htmlextra: //Report options

            {

                export: '.\\Results.html', //Directory and name

                template: '.\\InnovaAPITemplate.hbs', //Template used for report. Html, CSS and JS are all embedded.

                title: 'Innovations API',

                showEnviornmentData: true,

                browserTitle: "Innovations API",

                showMarkdownLinks: true,                

                showFolderDescription: true,

                //skipSensitiveData: true //Hides request header because it can contain the authorization tokens.               

            }

        }

    },// <-- End of options object

    function (err,summary)// <-- Beginning of callback function

    {

        if (err)

        { 

            console.log(err);

            throw err; 

        } else 

        {

            //console.log(summary);

        }

    }// <-- End of callback 

).on('start', function (err, args) { // <-- start event. 

        console.log('running a collection...');

}).on('done', function (err, summary) { // <-- done event.

    if (err || summary.error) {

        console.error('\nCollection run encountered an error.');

    }

    else {

        console.log('\nCollection run completed.');

    }

})

;

```

That is awesome! Thanks!
