SocketTimeoutExcpetion on webhook request


#1

Hi, I am trying to use a repository webhook to trigger an internal script:

{
“name”: “getPayload”,
“content”: “import groovy.json.JsonSlurper;def input = new JsonSlurper().parseText(args);log.info(args.toString());”,
“type”: “groovy”
}

I created and tested this succesfully by

curl -X POST “https://ont.domain.com/nexus/service/rest/v1/script/getPayload/run” -H “accept: application/json” -H “Content-Type: text/plain” -d “{“year”:“2018”}”

(url obviously is substituted here)

Then I created a repository webhook and added the url https://ont.domain.com/nexus/service/rest/v1/script/getPayload/run
and deployed an artifact to the respective repository.
As soon as an artifact is uploaded to the repository and the hook is triggered, a SocketTimeoutExcpetion is thrown:

2019-02-06 16:47:40,892+0100 ERROR [event-9-thread-8414] admin org.sonatype.nexus.internal.webhooks.WebhookServiceImpl - Failed to send webhook request: WebhookRequest{id=‘b3e4f99c-28bd-4c05-8802-38d027f4c66d’, webhook=rm:repository:component, payload=org.sonatype.nexus.repository.webhooks.RepositoryComponentWebhook$RepositoryComponentWebhookPayload@5a2eaaf1, url=https://ont.domain.com/nexus/service/rest/v1/script/getPayload/run}
java.net.SocketTimeoutException: Read timed out

Any thoughts?


#2

Go to “system/http” in the admin UI. If you have an http proxy server configured try adding the host name of the webhook to the non-proxy hosts list.