Subscribe Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

Npm authentication failed

Hi,

I’m trying to set the integration with postman/newman.
I’m using npm version 6.13.4 with testrail reporter.
I’ve enabled api and created a new API keys for my user.

I’ve set the environment params as follow:

TESTRAIL_DOMAIN=.testrail.io
TESTRAIL_USERNAME=
TESTRAIL_APIKEY=
TESTRAIL_PROJECTID=

Each time I’m trying to run a collection I’m getting the following error:

Error: Server responded to https://XXXX.testrail.io/index.php?/api/v2/get_project/3 with status code 401:
{“error”:“Authentication failed: invalid or missing user/password or session cookie.”}
at Response.getBody (C:\Users\XXXX\AppData\Roaming\npm\node_modules\newman-reporter-testrail\node_modules\http-response-object\lib\index.js:41:23)
at EventEmitter. (C:\Users\XXXX\AppData\Roaming\npm\node_modules\newman-reporter-testrail\lib\TestrailReporter.js:29:66)
at EventEmitter.emit (C:\Users\XXXX\AppData\Roaming\npm\node_modules\newman\node_modules\eventemitter3\index.js:203:33)
at done (C:\Users\XXXX\AppData\Roaming\npm\node_modules\newman\lib\run\index.js:280:29)
at C:\Users\XXXX\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\backpack\index.js:58:34
at PostmanCollectionRun._process (C:\Users\XXXX\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:163:13)
at PostmanCollectionRun. (C:\Users\XXXX\AppData\Roaming\npm\node_modules\newman\node_modules\postman-runtime\lib\runner\run.js:169:76)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7) {
statusCode: 401,
headers: {
date: ‘Thu, 19 Dec 2019 10:34:39 GMT’,
‘content-type’: ‘application/json; charset=utf-8’,
‘content-length’: ‘87’,
connection: ‘close’,
server: ‘Apache’,
‘set-cookie’: [
‘tr_session=6f7e0718-1d9d-4d34-811d-1ed50c815ea0; secure; HttpOnly’
]
},
body: <Buffer 7b 22 65 72 72 6f 72 22 3a 22 41 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 20 66 61 69 6c 65 64 3a 20 69 6e 76 61 6c 69 64 20 6f 72 20 6d 69 73 73 69 6e … 37 more bytes>,
url: ‘https://XXXX.testrail.io/index.php?/api/v2/get_project/3

Not sure what else should I configure or set, please advise…

Thanks!