Skip to content

getProcessById fails #150

@maasha

Description

@maasha

CoreClient getProcessByID fails regularly, maybe 1/10. Appears to be some async issue either in the extension api library or backend.

/**
 * Get the current process for a given projectId.
 *
 * @param coreClient Client for accessing core data.
 * @param projectId Project ID.
 * @returns Current process.
 */
export const getCurrentProcess = async (coreClient: CoreRestClient, projectId: string) => {
    try {
        console.log('Getting current process for project:', projectId)
        const projectProperties = await coreClient.getProjectProperties(projectId)
        console.log('Project properties:', projectProperties)
        try {
            const currentProcessTemplate = projectProperties.find(
                (prop) => prop.name === 'System.CurrentProcessTemplateId'
            )
            console.log('Current process template:', currentProcessTemplate)
            const currentProcessTemplateId = currentProcessTemplate?.value

            const currentProcess = await coreClient.getProcessById(currentProcessTemplateId)

            return currentProcess
        } catch (error1) {
            console.error('Error getProcessById:', error1)
            throw error1
        }
    } catch (error2) {
        console.error('Error getProjectProperties:', error2)
        throw error2
    }
}

This is "azure-devops-extension-api": "^4.235.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions