Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can Scriptrunner notifications work when the issue is created by email?

Sharon Connell
Contributor
April 20, 2018

We are using Jira Software cloud and Scriptrunner to create custom notifications on creation and close of an issue. This was working fine until the business requested users be able to send an email to create an issue. Issues are created via email as expected but SR does not send the notification. The error I receive is below. The developer who helped me with the script is no longer with the company and I am trying to learn Groovy. I'd like to know if it is even possible to have SR work with email ingestion before spending time or asking for help from another developer.

"Error: java.lang.RuntimeException: com.mashape.unirest.http.exceptions.UnirestException: java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Cannot': was expecting ('true', 'false' or 'null') at [Source: Cannot generate an OAuth token for null user; line: 1, column: 7] at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:143) at com.mashape.unirest.request.BaseRequest.asObject(BaseRequest.java:80) at com.adaptavist.sr.cloud.UnirestCustomiser.executeRequest(UnirestCustomiser.groovy:144) at com.adaptavist.sr.cloud.UnirestCustomiser.execAsPrefixMethod(UnirestCustomiser.groovy:109) at com.adaptavist.sr.cloud.UnirestCustomiser$_instrumentRequest_closure3.doCall(UnirestCustomiser.groovy:91) at Script1.run(Script1.groovy:7) at Script1$run.call(Unknown Source) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:30) at com.adaptavist.sr.cloud.workflow.SendNotification.run(SendNotification.groovy:121) Caused by: java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Cannot': was expecting ('true', 'false' or 'null') at [Source: Cannot generate an OAuth token for null user; line: 1, column: 7] at com.mashape.unirest.http.HttpResponse.<init>(HttpResponse.java:106) at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:139) at com.mashape.unirest.request.BaseRequest.asObject(BaseRequest.java:80) at com.adaptavist.sr.cloud.UnirestCustomiser.executeRequest(UnirestCustomiser.groovy:144) at com.adaptavist.sr.cloud.UnirestCustomiser.execAsPrefixMethod(UnirestCustomiser.groovy:109) at com.adaptavist.sr.cloud.UnirestCustomiser$_instrumentRequest_closure3.doCall(UnirestCustomiser.groovy:91) at Script1.run(Script1.groovy:7) at Script1$run.call(Unknown Source) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:30) at com.adaptavist.sr.cloud.workflow.SendNotification.run(SendNotification.groovy:121) at com.adaptavist.sr.cloud.MainHandler.executeScript(MainHandler.groovy:282) at com.adaptavist.sr.cloud.MainHandler.processInput(MainHandler.groovy:247) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure1.doCall(MainHandler.groovy:117) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure1.doCall(MainHandler.groovy) Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Cannot': was expecting ('true', 'false' or 'null') at [Source: Cannot generate an OAuth token for null user; line: 1, column: 7] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2299) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1458) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3604) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3549) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2580) at com.fasterxml.jackson.databind.ObjectMapper$readValue$4.call(Unknown Source) at com.adaptavist.sr.cloud.MainHandler$1.readValue(MainHandler.groovy:82) at com.mashape.unirest.http.HttpResponse.<init>(HttpResponse.java:101) ... 13 more"

 

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Champion
April 23, 2018

Hi Sharron,

Thank you for your question.

ScriptRunner Script should still be able to send notifications to the script along as the script have a valid reporter set like they would do if the issue was configured inside of Jira.

Can you please validate your incoming mail settings and make sure that users are being created if an account does not exist related to the email address that they are emailing from to create the issue.

The error above indicates that it is unable to get an Oauth token for the user running the script so you may consider looking to run the script as the ScriptRunner add on user.

If this answer has solved your issue can you please accept it in order to mark this answer as correct for users who are searching for a similar issue.

Regards,

Kristian

Sharon Connell
Contributor
April 30, 2018

Hi Kristian,

We do not want users created, but most of the reporters are licensed users. I will test a bit further.

Thank you,

Sharon

Suggest an answer

Log in or Sign up to answer