As far as I now you can get information like the issueKey only in the backend when using Custom UI. Define a function like so:
resolver.define('fooFunction', async (req) => {
const {projectId, issueKey} = req.context.extensionContext;
return issueKey
});
and retrieve it in the web-client:
const issueKey = await invoke('fooFunction', {});
I guess this will become easier in near future when Atlassian allows us to use the AP object from Custom UI.