Can I return a value from an Atlassian Forge resolver to a custom UI written in Vue?

767 Views Asked by At

I have an Atlassian forge resolver

import Resolver from '@forge/resolver'

const resolver = new Resolver()

resolver.define('getIssueKey', ({context}) => {
    const jiraKey = context.extension.issue.key
    console.info(`Returning jira key ${jiraKey}`)
    return jiraKey
})

export const handler = resolver.getDefinitions()

I also have a Vue Custom UI which invokes the resolver

<script lang='ts'>
import { defineComponent } from 'vue'
import { invoke } from '@forge/bridge'    

export default defineComponent({
    mounted() {
        var jiraKey = 'Retrieving jira key' as any
        invoke('getIssueKey').then((data) => {
            console.info('Success')
            jiraKey = data
        }).catch(() => jiraKey = 'Error retrieving jira key')
    }
})

I know the resolver is invoked because I can see a console log "INFO 21:37:23.021 Returning jira key ESP-343" but neither the "then" or "catch" portion of the promise are ever called. I see no further logs.

Have I made a coding error that I can't see or must a custom UI in forge be written in React?

1

There are 1 best solutions below

0
On BEST ANSWER

I got some help from Atlassian and found the problem. I wasn't aware that the custom UI logs don't show up in the tunnel and must be viewed in the browser. With some visibility of the logs I was able to debug my code (not the code above, which does work).

See Atlassian link here