How to properly get issue id or issue key of current issues via Forge Custom UI

Am trying to get Issue Id or Issuekey of a current Issues using Forge Custom UI but it throws errors issueKey undefined

import Resolver from '@forge/resolver';
import api, { route } from "@forge/api";

import { useProductContext } from '@forge/ui';

const resolver = new Resolver();

resolver.define('issueFunction1', async (req) => {
    const {issueKey} = req.context.extensionContext;
    return issueKey;


resolver.define('issueFunction2', async (req) => {
    const { platformContext: { issueKey } } = useProductContext();
 return issueKey;