Error while syncing on premise JIRA to the JIRA Cloud

Originally asked by Dusan Vuckovic on 21 May 2021 (original question)


Hi ,

I have a project in on premise JIRA that I copied over to the Cloud. Now I just want to keep them in unidirectional sync (from on-premise to the Cloud) . Its a 1:1 relation in every sense. But I keep getting this error which is blocking the sync:

Error Detail Message:

javax.script.ScriptException: services.jcloud.exception.IssueErrorCollectionException: 
Field Epic Name is required.: customfield_10011.

Error Stack Trace

com.exalate.api.exception.script.IssueTrackerScriptException: javax.script.ScriptException: services.jcloud.exception.IssueErrorCollectionException: 
Field Epic Name is required.: customfield_10011. at com.exalate.error.services.ScriptExceptionCategoryService.$anonfun$categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions$1
(ScriptExceptionCategoryService.scala:29) at com.exalate.error.services.ScriptExceptionCategoryService.$anonfun$categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions$1$adapted(ScriptExceptionCategoryService.scala:27) at scala.collection.immutable.Stream.foreach(Stream.scala:533) at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:27) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:57) at com.exalate.replication.services.processor.CreateIssueProcessor.$anonfun$executeScriptRules$1(CreateIssueProcessor.scala:123) at scala.util.Try$.apply(Try.scala:213) at com.exalate.replication.services.processor.CreateIssueProcessor.executeScriptRules(CreateIssueProcessor.scala:120) at com.exalate.replication.services.processor.CreateIssueProcessor.createIssue(CreateIssueProcessor.scala:82) at com.exalate.replication.services.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.scala:42) at com.exalate.replication.services.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.scala:21) at com.exalate.replication.services.replication.in.RequestProcessorService.$anonfun$processSyncRequest$2(RequestProcessorService.scala:180) at scala.util.Try$.apply(Try.scala:213) at com.exalate.replication.services.replication.in.RequestProcessorService.processSyncRequest(RequestProcessorService.scala:157) at com.exalate.replication.services.replication.in.RequestProcessorService.$anonfun$processSyncRequestsForIssue$1(RequestProcessorService.scala:107) at com.exalate.replication.services.replication.in.RequestProcessorService.$anonfun$processSyncRequestsForIssue$1$adapted(RequestProcessorService.scala:106) at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126) at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122) at scala.collection.immutable.List.foldLeft(List.scala:91) at com.exalate.replication.services.replication.in.RequestProcessorService.processSyncRequestsForIssue(RequestProcessorService.scala:106) at com.exalate.replication.services.replication.in.RequestProcessorService.$anonfun$processSyncRequests$6(RequestProcessorService.scala:68) at com.exalate.replication.services.replication.in.RequestProcessorService.$anonfun$processSyncRequests$6$adapted(RequestProcessorService.scala:68) at scala.collection.immutable.List.foreach(List.scala:431) at com.exalate.replication.services.replication.in.RequestProcessorService.$anonfun$processSyncRequests$1(RequestProcessorService.scala:68) at com.exalate.replication.services.replication.in.RequestProcessorService.$anonfun$processSyncRequests$1$adapted(RequestProcessorService.scala:50) at scala.collection.Iterator.foreach(Iterator.scala:943) at scala.collection.Iterator.foreach$(Iterator.scala:943) at scala.collection.AbstractIterator.foreach(Iterator.scala:1431) at scala.collection.IterableLike.foreach(IterableLike.scala:74) at scala.collection.IterableLike.foreach$(IterableLike.scala:73) at scala.collection.AbstractIterable.foreach(Iterable.scala:56) at com.exalate.replication.services.replication.in.RequestProcessorService.processSyncRequests(RequestProcessorService.scala:50) at com.exalate.replication.services.replication.worker.RequestWorkerActor$$anonfun$com$exalate$replication$services$replication$worker$RequestWorkerActor$$waitingForAfterTheLastMessage$1.applyOrElse(RequestWorkerActor.scala:119) at akka.actor.Actor.aroundReceive(Actor.scala:535) at akka.actor.Actor.aroundReceive$(Actor.scala:533) at com.exalate.replication.services.replication.worker.RequestWorkerActor.aroundReceive(RequestWorkerActor.scala:98) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:575) at akka.actor.ActorCell.invoke(ActorCell.scala:545) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: javax.script.ScriptException: javax.script.ScriptException: services.jcloud.exception.IssueErrorCollectionException: Field Epic Name is required.: customfield_10011. at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:98) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:55) ... 41 more Caused by: javax.script.ScriptException: services.jcloud.exception.IssueErrorCollectionException: Field Epic Name is required.: customfield_10011. at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ... 44 more Caused by: services.jcloud.exception.IssueErrorCollectionException: Field Epic Name is required.: customfield_10011. at services.jcloud.transport.JCloudRestErrorHandlingService$.errorCollectionValueToException(JCloudRestErrorHandlingService.scala:27) at services.jcloud.transport.JCloudClient.$anonfun$createIssue$4(JCloudClient.scala:547) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) ... 5 more

Any subtle way maybe to sync the same projects in one direction without becoming Groovy master?

Thank you


Comments:

Serhiy Onyshchenko commented on 21 May 2021

Yeah, becoming a groovy master is definitely something you can put to your CV after using Exalate long enough :joy:

Dusan Vuckovic commented on 21 May 2021

(old community) (old community) They called it Groovy cause you need to be on LSD while programming (and playing this in the background)

Serhiy Onyshchenko commented on 21 May 2021

Woah, I see your video and raise you a cat one:

Dusan Vuckovic commented on 21 May 2021

Fold (old community) (old community) (old community)

Serhiy Onyshchenko commented on 21 May 2021

:rofl::rofl::rofl:

Answer by Dusan Vuckovic on 21 May 2021

Serhiy,

I commented out Watchers and it started working (so it seems) . Thx man .

Tell me please , are there any other “tricky” fields to have in mind here ? I just want 1:1 copy in one direction .


Comments:

Serhiy Onyshchenko commented on 21 May 2021

Any field that requires other things but the issue itself to be there (like sprints, user fields, and such) can be tricky.
Just make a list of all the content you want to get synced, and see what do you find in docs.
If there’s anything missing - feel free to post on community.

Answer by Dusan Vuckovic on 21 May 2021

With your line , new error emerged :

Error Detail Message:

Unexpected error occurred. Generate an exalate support.zip file and contact support.

Error Stack Trace

com.exalate.api.exception.bug.BugException: Unexpected error occurred. Generate an exalate support.zip file and contact support. at com.exalate.error.services.BugExceptionCategoryService.generateBugException(BugExceptionCategoryService.scala:43) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$1.applyOrElse(RequestProcessorService.scala:189) at com.exalate.replication.services.replication.in.RequestProcessorService$$anonfun$1.applyOrElse(RequestProcessorService.scala:182) at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:417) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: java.lang.NullPointerException at services.jcloud.IssueService.$anonfun$applyWatchers$6(IssueService.scala:548) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:285) at scala.collection.Iterator.foreach(Iterator.scala:943) at scala.collection.Iterator.foreach$(Iterator.scala:943) at scala.collection.AbstractIterator.foreach(Iterator.scala:1431) at scala.collection.IterableLike.foreach(IterableLike.scala:74) at scala.collection.IterableLike.foreach$(IterableLike.scala:73) at scala.collection.AbstractIterable.foreach(Iterable.scala:56) at scala.collection.TraversableLike.map(TraversableLike.scala:285) at scala.collection.TraversableLike.map$(TraversableLike.scala:278) at scala.collection.mutable.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:50) at scala.collection.SetLike.map(SetLike.scala:105) at scala.collection.SetLike.map$(SetLike.scala:105) at scala.collection.mutable.AbstractSet.map(Set.scala:50) at services.jcloud.IssueService.applyWatchers(IssueService.scala:548) at services.jcloud.IssueService.$anonfun$applyChanges$9(IssueService.scala:506) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) … 14 more


Comments:

Dusan Vuckovic commented on 21 May 2021

Nope. Tried diff variations. Still getting this unidentified error.

Serhiy Onyshchenko commented on 21 May 2021

This one seems to be caused by watchers sync
Are you doing something like

issue.watchers = replica.watchers

?
try

if (replica.watchers && !replica.watchers.empty) {  issue.watchers = replica.watchers
    .collect { nodeHelper.getUserByEmail(it.email) }
    .findAll()
}

Let me know

Answer by Dusan Vuckovic on 21 May 2021

Hi ,

I had one

issue.customFields."Epic Name"=replica.customFields."Epic Name"

It didn’t work.

So I followed your articles and replaced with:

// should be at the end of the incoming sync script

Epic.receive()

Comments:

Serhiy Onyshchenko commented on 21 May 2021

Were you also exposing the “Epic Name” (by doing replica.customFields."Epic Name" = issue.customFields."Epic Name" from Outgoing script of sending side) / used Epic.send() from the sending side when the sync started?

Dusan Vuckovic commented on 21 May 2021

Yes yes . Sure .

Serhiy Onyshchenko commented on 21 May 2021

In this case you can also make sure that Exalate doesn’t trip over transactions created before you started doing

Epic.send()

on sending side by doing
the following thing on the receiving Incoming processor beginning:

if (replica.type?.name == "Epic" && !replica."Epic Name") { 
  return 
}

Answer by Serhiy Onyshchenko on 21 May 2021

Hey, Dusan Vuckovic, it seems that you need to add a rule into your incoming sync script which would set the “Epic Name” custom fields for Epics.
Try adding this to the end of your incoming sync script:

// ...
if("Epic".equalsIgnoreCase(issue.type?.name ?: issue.typeName)) {
  issue."Epic Name" = replica."Epic Name" ?: replica.summary
}

Let me know, if this helps.
Regards, Serhiy.


Comments:

Serhiy Onyshchenko commented on 21 May 2021

BTW

issue."Epic Name" = ...

is doing the same as

issue.customFields."Epic Name".value = ...