janjoerke / vscode-jenkins-pipeline-linter-connector

MIT License
60 stars 21 forks source link

Token-based authentication is broken #19

Open mpern opened 4 years ago

mpern commented 4 years ago

VS Code 1.40.2 Jenkins Pipeline Linter Connector 1.2.0

After a quick look into the source, this line seems to be the issue: https://github.com/janjoerke/vscode-jenkins-pipeline-linter-connector/blob/master/src/extension.ts#L63

The variable options doesn't have a property headers...

notificationsAlerts.ts:38 TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at requestCrumb (/home/user/.vscode/extensions/janjoerke.jenkins-pipeline-linter-connector-1.2.0/out/extension.js:65)
    at /home/user/.vscode/extensions/janjoerke.jenkins-pipeline-linter-connector-1.2.0/out/extension.js:36
    at Generator.next (<anonymous>)
    at /home/user/.vscode/extensions/janjoerke.jenkins-pipeline-linter-connector-1.2.0/out/extension.js:7
    at new Promise (<anonymous>)
    at __awaiter (/home/user/.vscode/extensions/janjoerke.jenkins-pipeline-linter-connector-1.2.0/out/extension.js:3)
    at /home/user/.vscode/extensions/janjoerke.jenkins-pipeline-linter-connector-1.2.0/out/extension.js:17
    at v._executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:527)
    at v.$executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:528)
    at f._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:646)
    at f._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:645)
    at f._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:644)
    at f._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:643)
    at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:641
    at l.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47)
    at _.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:187)
    at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:798
    at l.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47)
    at _.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:187)
    at t.PersistentProtocol._receiveMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:191)
    at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:188
    at l.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47)
    at f.acceptChunk (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:184)
    at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:184
    at Socket.t (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:193)
    at Socket.emit (events.js:200)
    at addChunk (_stream_readable.js:294)
    at readableAddChunk (_stream_readable.js:275)
    at Socket.Readable.push (_stream_readable.js:210)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166)
pletnes commented 4 years ago

I think I've encountered the same issue. I notice that if I leave out my password and try using the token based auth, I get this VS Code error message:

Cannot convert undefined or null to object

I figured it was an empty setting and, it seems, it is. So somehow the code is trying to access the password field, and it's empty, so it's "undefined or null", but should be a string.

atiniir commented 4 years ago

I've found if i put my token in for the password it works. i tried this after noticing a lot of plugins mention using tokens in their password fields, or call the field password_or_token

though this is pretty confusing. i think the token param should be removed and the docs updated to say to put the token in the password field

mbedded commented 3 years ago

Interesting point.. I took a look into my configuration (using token) and i have written my token value into jenkins.pipeline.linter.connector.pass (Settings as JSON). Maybe there is a typo in the code so "password" and "token" are exchanged?

ohartl commented 3 years ago

Would be fixed by #31