Project key is not found

Originally asked by Jonathan on 03 October 2019 (original question)


I don’t understand why the error is happening, I’m setting the key for the issue, here are the scripts: Outgoing

Outgoing

// https://docs.idalko.com/exalate/display/ED/How+to+synchronize+epics
Epic.sendEpicFirst()

replica.key            = issue.key
replica.type           = issue.type 
replica.reporter       = issue.reporter
replica.creator        = issue.creator
replica.summary        = issue.summary
replica.description    = issue.description
replica.comments       = issue.comments
replica.status         = issue.status
replica.parentId       = issue.parentId
replica.priority       = issue.priority
replica.attachments    = issue.attachments
replica.project        = issue.project
replica.issueLinks     = issue.issueLinks
replica.created        = issue.created
replica.updated        = issue.updated

// https://docs.idalko.com/exalate/display/ED/How+to+sync+story+points+field
replica.customFields."Story Points" = issue.customFields."Story Points"
replica.customFields."Epic Name"    = issue.customFields."Epic Name"

Incoming

Epic.receive()

if (firstSync) {

	if(replica.project.key == "WAND") {
    	issue.projectKey   = "WNG"
        issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Story"
        issue.labels       = "Android"
    }
	else if(replica.project.key == "WNG") {
    	issue.projectKey   = "WAND"
		issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Story"
    }
}

if(issue.typeName == "Story") {
    issue.customFields."Story Points"?.value = replica.customFields."Story Points".value
}
else if (issue.typeName == "Epic") {
    issue.customFields."Epic Name".value = replica.customFields."Epic Name"?.value ?: replica.summary
}

issue.summary      = replica.summary
issue.description  = replica.description
issue.issueLinks   = replica.issueLinks
issue.priority     = replica.priority

issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
issue.priority     = nodeHelper.getPriority(replica.priority?.name ?: "Medium")

Error details

Script error details: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException: Project key is not found. Please fill issue.projectKey or issue.project parameter in script . Error line: CreateIssue.groovy:44

Stack trace

com.exalate.api.exception.script.CreateProcessorException: Script error details: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException: Project key is not found. Please fill issue.projectKey or issue.project parameter in script . Error line: CreateIssue.groovy:44 at com.exalate.error.services.ScriptExceptionCategoryService$.wrapAsCreateProcessorException(ScriptExceptionCategoryService.scala:53) at com.exalate.replication.services.processor.CreateIssueProcessor$$anonfun$1.applyOrElse(CreateIssueProcessor.scala:66) at com.exalate.replication.services.processor.CreateIssueProcessor$$anonfun$1.applyOrElse(CreateIssueProcessor.scala:59) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) at scala.util.Failure.recoverWith(Try.scala:202) at com.exalate.replication.services.processor.CreateIssueProcessor.createIssue(CreateIssueProcessor.scala:59) at com.exalate.replication.services.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.scala:32) at com.exalate.replication.services.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.scala:18) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequest$3.apply(RequestProcessorService.scala:157) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequest$3.apply(RequestProcessorService.scala:151) at scala.util.Try$.apply(Try.scala:191) at com.exalate.replication.services.replication.in.RequestProcessorService.processSyncRequest(RequestProcessorService.scala:151) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequestsForIssue$1.apply(RequestProcessorService.scala:103) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequestsForIssue$1.apply(RequestProcessorService.scala:103) at scala.collection.immutable.List.foreach(List.scala:381) at com.exalate.replication.services.replication.in.RequestProcessorService.processSyncRequestsForIssue(RequestProcessorService.scala:103) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequests$1$$anonfun$apply$4.apply(RequestProcessorService.scala:71) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequests$1$$anonfun$apply$4.apply(RequestProcessorService.scala:71) at scala.collection.immutable.List.foreach(List.scala:381) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequests$1.apply(RequestProcessorService.scala:71) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$processSyncRequests$1.apply(RequestProcessorService.scala:52) at scala.collection.Iterator$class.foreach(Iterator.scala:750) at scala.collection.AbstractIterator.foreach(Iterator.scala:1202) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at com.exalate.replication.services.replication.in.RequestProcessorService.processSyncRequests(RequestProcessorService.scala:52) at com.exalate.replication.services.replication.worker.RequestWorkerActor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply$mcV$sp(RequestWorkerActor.scala:33) at com.exalate.replication.services.replication.worker.RequestWorkerActor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply(RequestWorkerActor.scala:31) at com.exalate.replication.services.replication.worker.RequestWorkerActor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply(RequestWorkerActor.scala:31) at com.exalate.replication.services.utils.LoggingUtils$.tryWithLoggedBugs(LoggingUtils.scala:12) at com.exalate.replication.services.replication.worker.RequestWorkerActor$$anonfun$receive$1.applyOrElse(RequestWorkerActor.scala:31) at akka.actor.Actor$class.aroundReceive(Actor.scala:484) at com.exalate.replication.services.replication.worker.RequestWorkerActor.aroundReceive(RequestWorkerActor.scala:22) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) at akka.actor.ActorCell.invoke(ActorCell.scala:495) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) at akka.dispatch.Mailbox.run(Mailbox.scala:224) at akka.dispatch.Mailbox.exec(Mailbox.scala:234) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Caused by: com.exalate.api.exception.script.IssueTrackerScriptException: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException: Project key is not found. Please fill issue.projectKey or issue.project parameter in script . Error line: CreateIssue.groovy:44 at com.exalate.error.services.ScriptExceptionCategoryService$$anonfun$categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions$1.apply(ScriptExceptionCategoryService.scala:24) at com.exalate.error.services.ScriptExceptionCategoryService$$anonfun$categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions$1.apply(ScriptExceptionCategoryService.scala:22) at scala.collection.immutable.Stream.foreach(Stream.scala:594) at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:22) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:42) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:33) at com.exalate.replication.services.processor.CreateIssueProcessor$$anonfun$2.apply(CreateIssueProcessor.scala:57) at scala.util.Try$.apply(Try.scala:191) at com.exalate.replication.services.processor.CreateIssueProcessor.createIssue(CreateIssueProcessor.scala:52) ... 36 more Caused by: javax.script.ScriptException: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException: Project key is not found. Please fill issue.projectKey or issue.project parameter in script at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:69) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:40) ... 40 more Caused by: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException: Project key is not found. Please fill issue.projectKey or issue.project parameter in script at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:348) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:145) ... 43 more Caused by: com.exalate.api.exception.IssueTrackerException: Project key is not found. Please fill issue.projectKey or issue.project parameter in script at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) at CreateIssue.create(CreateIssue.groovy:44) at CreateIssue$create.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at Epic$EpicCtx.receive(Epic.groovy:282) at Epic$EpicCtx$receive.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112) at Epic.receive(Epic.groovy:33) at Epic$receive.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112) at Script1288.run(Script1288.groovy:1) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:345) ... 44 more

Answer by Francis Martens (Exalate) on 03 October 2019

Please move the epic.receive() to the bottom of the script. It requires the project contect to be able to receive the information.


Comments:

Jonathan commented on 03 October 2019

That’s not described in the docs, thanks, it’s working now

Francis Martens (Exalate) commented on 03 October 2019

Thanks for highlighting - will add it to the doc

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.