vscode-jenkins-pipeline-linter-connector icon indicating copy to clipboard operation
vscode-jenkins-pipeline-linter-connector copied to clipboard

TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Jenkins-Crumb"]

Open dzintars opened this issue 4 years ago • 8 comments

Wanted to try out this extension, but without no luck.

}
  "jenkins.pipeline.linter.connector.crumbUrl": "https://jenkins.example.com/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb)",
  "jenkins.pipeline.linter.connector.url": "https://jenkins.example.com/pipeline-model-converter/validate",
  "jenkins.pipeline.linter.connector.user": "vscode-jenkins-pipeline-linter",
  "jenkins.pipeline.linter.connector.pass": "2391d2db4z8fe92307b8b789f57a4328cf",
  "jenkins.pipeline.linter.connector.token": "2391d2db4z8fe92307b8b789f57a4328cf",
  }

I have pretty secure http2 proxy in front of my Jenkins, but i assume that https should work just fine with this extension.

Postman GET https://jenkins.example.com/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb) initially returns just 500 with:

<!DOCTYPE html>
<html class="">

<head resURL="/static/4cbb666e" data-rooturl="" data-resurl="/static/4cbb666e" data-extensions-available="true"
	data-unit-test="false" data-imagesurl="/static/4caa677e/images" data-crumb-header="Jenkins-Crumb"
	data-crumb-value="a0f12091a9580ff88e74wwy457jikl092354d4d9515c9b2b16e89e754012a128">

.... the rest of some page

Jenkins logs of Postman error:

2021-01-06 20:34:12.240+0000 [id=6403]	WARNING	h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID 1e699b43-ad36-4888-847f-7dbd7a3095a2
org.dom4j.InvalidXPathException: Invalid XPath expression: concat(//crumbRequestField,":",//crumb) HTTP/1.1 Unexpected 'HTTP/1.1'

which tells me that Postman somehow automatically appended HTTP/1.1 to the xpath query parameter (not sure why). After manually removing it i get response 200 with:

Jenkins-Crumb:a0f12091a9580ff88e74wwy457jikl092354d4d9515c9b2b16e89e754012a128

Which tells me that my Jenkins instance is healthy.

But the extension still does not work.

I have no way to test http only and i am not sure is it relevant there at all.

Similar issues: https://github.com/janjoerke/vscode-jenkins-pipeline-linter-connector/issues/1 https://github.com/janjoerke/vscode-jenkins-pipeline-linter-connector/issues/2 https://github.com/janjoerke/vscode-jenkins-pipeline-linter-connector/issues/13

P.S Keys are faked. 😃

dzintars avatar Jan 08 '21 12:01 dzintars

I had got it worked only as http and public Jenkins IP address. So there is something to deal with ... proxy, TLS termination, God knows what else.

dzintars avatar Jan 12 '21 16:01 dzintars

Detect Jenkinsfile syntax, output No Jenkinsfile specified

hengeek avatar Jun 10 '21 07:06 hengeek

+1

elfprince13 avatar Aug 09 '22 20:08 elfprince13

+1

txynidakis avatar Oct 05 '22 22:10 txynidakis

+1

kamil-j-kion avatar Oct 28 '22 10:10 kamil-j-kion

Did anyone get this problem fixed?

Some work around suggest setting up env variables but no luck ...

egomez99 avatar Feb 02 '23 02:02 egomez99

I've got it working by setting the connector.url, connector.user and connector.token only. When you set the connector.token you do not need the connector.pass and connector.crumbUrl.

If you got the following error: Error: unable to verify the first certificate then make sure to set the connector.strictssl to false. Hope it helps.

sapipeti avatar Feb 02 '23 12:02 sapipeti

I confirm solution proposed by @sapipeti worked like a charm. Thank You!

egomez99 avatar Feb 02 '23 15:02 egomez99