sonar-scanner-npm icon indicating copy to clipboard operation
sonar-scanner-npm copied to clipboard

Error: Basic authentication must be done with auth option

Open Smasherr opened this issue 3 years ago • 1 comments

When specifying a download mirror that requires authentication...

export SONAR_SCANNER_MIRROR="https://${U}:${P}@${SQ_SCANNER_MIRROR_PATH}/"

the scan fails

$ sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.login="${SONAR_TOKEN}"
[10:12:17] Starting analysis...
[10:12:17] Checking if executable exists: /root/.sonar/native-sonar-scanner/sonar-scanner-4.5.0.2216-linux/bin/sonar-scanner
[10:12:17] Could not find executable in "/root/.sonar/native-sonar-scanner".
[10:12:17] Proceed with download of the platform binaries for SonarScanner...
[10:12:17] Creating /root/.sonar/native-sonar-scanner
[10:12:17] Downloading from [https://[MASKED]/sonar-scanner-cli-4.5.0.2216-linux.zip]
[10:12:17] (executable will be saved in cache folder: /root/.sonar/native-sonar-scanner)
/usr/local/lib/node_modules/sonarqube-scanner/node_modules/got/index.js:274
		throw new Error('Basic authentication must be done with auth option');
		^
Error: Basic authentication must be done with auth option
    at normalizeArguments (/usr/local/lib/node_modules/sonarqube-scanner/node_modules/got/index.js:274:9)
    at Function.got.stream (/usr/local/lib/node_modules/sonarqube-scanner/node_modules/got/index.js:392:38)
    at module.exports (/usr/local/lib/node_modules/sonarqube-scanner/node_modules/download/index.js:78:21)
    at getSonarScannerExecutable (/usr/local/lib/node_modules/sonarqube-scanner/dist/sonar-scanner-executable.js:104:3)
    at scanCLI (/usr/local/lib/node_modules/sonarqube-scanner/dist/index.js:31:3)
    at Object.<anonymous> (/usr/local/lib/node_modules/sonarqube-scanner/dist/bin/sonar-scanner:9:1)
    at Module._compile (internal/modules/cjs/loader.js:10[63](https://tools.services.zh.ch/zhservices/common/common-frontend/-/jobs/5966#L63):30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)

Smasherr avatar Mar 04 '22 10:03 Smasherr

Related https://github.com/sindresorhus/got/issues/184

Smasherr avatar Mar 04 '22 10:03 Smasherr

Hey @Smasherr, is this still an issue for you in the latest version?

gabssnake avatar Sep 26 '22 19:09 gabssnake

Hi @Smasherr,

I created a list of potential improvements and mentioned the problem you are/were experiencing:

  • #165

I'll close this issue for now. Feel free to reopen if you have more information.

gabssnake avatar Dec 04 '22 16:12 gabssnake