HTTP Notification Plugin Issue

111 views
Skip to first unread message

Sean

unread,
Oct 8, 2021, 6:01:52 AM10/8/21
to rundeck-discuss
Hi All,

I'm using rundeck 3.4.4 version with HTTP Notification plugin (build and placed the jar inside ./libtext folder) but it's unable to send the notification. Seeing below error in logs :

groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is 'R' with an int value of 82
Unable to determine the current character, it is not a string, number, array, or object
line number 2
index number 2
Request forbidden by administrative rules. Please make sure your request has a User-Agent header (http://developer.github.com/v3/#user-agent-required). Check https://developer.github.com for other possible causes.
^
at org.apache.groovy.json.internal.JsonParserCharArray.decodeValueInternal(JsonParserCharArray.java:202) ~[groovy-json-2.5.6.jar!/:2.5.6]
at org.apache.groovy.json.internal.JsonParserCharArray.decodeValue(JsonParserCharArray.java:153) ~[groovy-json-2.5.6.jar!/:2.5.6]
at org.apache.groovy.json.internal.JsonParserCharArray.decodeFromChars(JsonParserCharArray.java:42) ~[groovy-json-2.5.6.jar!/:2.5.6]
at org.apache.groovy.json.internal.JsonParserCharArray.parse(JsonParserCharArray.java:380) ~[groovy-json-2.5.6.jar!/:2.5.6]
at org.apache.groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:131) ~[groovy-json-2.5.6.jar!/:2.5.6]
at groovy.json.JsonSlurper.parse(JsonSlurper.java:218) ~[groovy-json-2.5.6.jar!/:2.5.6]
at groovyx.net.http.ParserRegistry.parseJSON(ParserRegistry.java:280) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]


Screenshot 2021-10-07 at 2.15.38 PM.png

rac...@rundeck.com

unread,
Oct 8, 2021, 8:06:44 AM10/8/21
to rundeck-discuss
Hi Sean,

Try to set the headers in JSON format.

Regards.

Sean

unread,
Oct 8, 2021, 8:20:14 AM10/8/21
to rundeck-discuss
No Luck, do we need to pass User-Agent in headers ? If yes, then what User-Agent value need to mention here?

Regards

rac...@rundeck.com

unread,
Oct 8, 2021, 8:35:07 AM10/8/21
to rundeck-discuss

It seems that your application is expecting this header. Probably these examples help you, the GitHub API documentation should be useful.

For example, to add a repository (borrowed from Postman examples, check the User-Agent header):

curl --location -g --request POST 'https://api.github.com/user/repos?access_token={{github_token}}' \
--header 'Accept: application/json' \
--header 'User-Agent: API-Evangelist-Network' \
--data-raw '{
  "name": "Planets API",
  "description": "This is an API for managing planets.",
  "homepage": "https://getpostman.com",
  "private": false,
  "has_issues": true,
  "has_projects": true
}'

Greetings.

Sean

unread,
Oct 8, 2021, 8:42:12 AM10/8/21
to rundeck-discuss
Thanks Much! It worked now... Just set the "User-Agent: API-Evangelist-Network" :) though it's not the correct value but for now it's working

Regards
Sean

rac...@rundeck.com

unread,
Oct 8, 2021, 8:50:08 AM10/8/21
to rundeck-discuss
Great!

Cheers!

Sean

unread,
Oct 11, 2021, 7:17:46 AM10/11/21
to rundeck-discuss
Hey,

I've one more query regarding fetching the logs for execution id, I created below json and passing it to Job notification so it can be invoked from Github client.
Is this feasible ? 

{
  "state": "failure",
  "context": "Test Case Failed",
}

Regards
Sean

rac...@rundeck.com

unread,
Oct 11, 2021, 8:39:03 AM10/11/21
to rundeck-discuss
Hi Sean,

The notification variables are available after the job execution, so, a good approach would be to add another step that takes the execution ID of the running job and uses it in your invocation.

This example could help you.

Hope it helps!
Reply all
Reply to author
Forward
0 new messages