I can't sync Required Components in Jira Cloud

Originally asked by Pablo Fernandez on 16 April 2021 (original question)


Hello,

I’m trying to synchronize bugs creation and updates from 2 Jira Cloud domains. However when it’s triggered on one side it’s failing on the other side with the following error in the incoming script: “Cannot set property ‘components’ on null object”

The Component field is the one by default in Jira. However it’s required on both sides. I manually created the component on both sides with exactly the same name but it doesn’t work.

I searched for help in your documentation and tried some scripts but I have the same issue.

Here you have my code:

Outgoing sync

replica.key            = issue.key
replica.type           = issue.type
replica.assignee       = issue.assignee
replica.reporter       = issue.reporter
replica.summary        = issue.summary
replica.description    = issue.description
replica.labels         = issue.labels
replica.comments       = issue.comments
replica.resolution     = issue.resolution
replica.status         = issue.status
replica.parentId       = issue.parentId
replica.priority       = issue.priority
replica.attachments    = issue.attachments
replica.project        = issue.project
replica.components     = issue.components

//Comment these lines out if you are interested in sending the full list of versions and components of the source project.
replica.project.versions = []
//replica.project.components = []

Incoming sync:

if(firstSync){
   issue.projectKey   = "CES"
   // Set type name from source issue, if not found set a default
   issue.typeName     = nodeHelper.getIssueType(replica.typeName)?.name ?: "Bug"
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
issue.labels       = replica.labels
issue.project.components = replica.project.components

//Components
issue.components = replica.components.collect {
    component ->
    nodeHelper.createComponent(
        issue,
        component.name,
        component.description,
        component.leadKey,
        component.assigneeType?.name()
    )
}

May you help me please?

Thank you in advance!

Pablo


Answer by Francis Martens (Exalate) on 18 April 2021

There is no such field

issue.project.components = replica.project.components

Can you take it out and see how the rest of your incoming sync is working