Unable to get context and pageId while running the code

src/index.js

import Resolver from ‘@forge/resolver’;
import api, { route } from “@forge/api”;
import { useProductContext } from “@forge/ui”;

import ForgeUI from ‘@forge/ui’;

const resolver = new Resolver();

resolver.define(‘getsummary’, async () => {

// Get the page ID from the context object
console.log(“getsummary is calling”);
const context = useProductContext();
const pageId = context.contentId;

//let pageId=393217;
// Fetch the page content using the getPageData function (replace with your implementation)
const pageData = await getPageData(pageId);

// Process the page data to extract the summary (replace with your logic)
//const summary = processPageDataForSummary(pageData);
// return pageData;
//return summary;
//return pageId;
return (JSON.stringify(pageData));
});

// Function to fetch page data from Confluence (replace with your implementation)
// async function getPageData(pageId) {

// console.log(“Page data is calling”);
// const fetchedPageData = await api.asApp().requestConfluence(route/wiki/api/v2/pages/${pageId}?body-format=storage, {
// //const fetchedPageData = await api.asApp().requestConfluence(route/wiki/api/v2/pages/393217?body-format=storage, {
// headers: {
// ‘Accept’: ‘application/json’
// }
// });
// return fetchedPageData;
// }

async function getPageData(pageId) {
const response = await api.asApp().requestConfluence(route/wiki/api/v2/pages/${pageId}?body-format=storage, {
headers: {
‘Accept’: ‘application/json’
}
});

const responseData = await response.json();
const pageContent = responseData.body && responseData.body.storage ? responseData.body.storage.value : ‘unable to get data’;

return pageContent;
}

// Function to process page data for summary extraction (replace with your logic)
function processPageDataForSummary(pageData) {
// Implement logic to extract summary from the fetched page data
// This might involve parsing specific sections, using NLP techniques, etc.
// … (your logic to extract summary from pageData)

// Return the extracted summary
return extractedSummary;
}

export const handler = resolver.getDefinitions();