When i run the forge tunnel command, i can see the invocations coming in but i can’t see the console.log inside my function.
The function is empty right now and it looks like this
export async function issueUpdated(event: WebhookEvent, context: Context): Promise {
console.log(“hello”);}
what could i be doing wrong?
Hi Kayode,
Are you missing an await
calling out to issueUpdated?
Hard to determine if I have given the right advice; if you could provide more info on the manifest and the full part of your index file to help debug.
Cheers
Ben
Sure, adding await doesn’t fix it
All i see in the forge tunnel is invocation: 682b8f307d81dcba15d1b63eaf9e0242 resolvers/webhooks.issueUpdated
export async function issueUpdated(event:any, context:any): Promise {
await console.log(“hello”);
}
Very simple for demonstration purposes, i just want to be able to see the data as it’s coming in so i can understand my errors
my manifest looks like this
modules:
jira:issuePanel:
- key: sift-issue-panel
resource: frontend
resolver:
function: issue-panel-handler
render: native
title: Sift Ingest!
icon: https://developer.atlassian.com/platform/forge/images/icons/issue-panel-icon.svg
function:
- key: app-installed-handler
handler: resolvers/webhooks.appInstalled
- key: issue-created-handler
handler: resolvers/webhooks.issueCreated
- key: issue-updated-handler
handler: resolvers/webhooks.issueUpdated
- key: issue-assigned-handler
handler: resolvers/webhooks.issueAssigned
- key: issue-panel-handler
handler: resolvers/index.handler
trigger:
- key: app-installed-trigger
function: app-installed-handler
events:
- avi:forge:installed:app
- key: issue-created-trigger
function: issue-created-handler
events:
- avi:jira:created:issue
- key: issue-updated-trigger
function: issue-updated-handler
events:
- avi:jira:updated:issue
- key: issue-assigned-trigger
function: issue-assigned-handler
events:
- avi:jira:assigned:issue
resources:
- key: frontend
path: src/frontend/index.tsx
app:
runtime:
name: nodejs22.x
id: ari:cloud:ecosystem::app/
permissions:
scopes:
- read:jira-work
- read:jira-user
- read:issue:jira
- read:comment:jira
Hello Kayode,
I tried to reproduce your error using a similar setup to what you have but am able to see the console.log
statement in my forge tunnel. What I did was:
- Run
forge create
and select aJira, UI Kit, jira-issue-panel
template. - Create a file in
src/resolvers/webhooks.js
and add the following function
export const issueUpdated = async (event, context) => {
console.log("hello", event, context);
};
- Add the appropriate scopes, trigger and function to the manifest. My final manifest looks like
modules:
jira:issuePanel:
- key: fix-dac-hello-world-issue-panel
resource: main
resolver:
function: resolver
render: native
title: fix-dac
icon: https://developer.atlassian.com/platform/forge/images/icons/issue-panel-icon.svg
trigger:
- key: issue-updated-trigger
function: issue-updated-handler
events:
- avi:jira:updated:issue
function:
- key: resolver
handler: index.handler
- key: issue-updated-handler
handler: resolvers/webhooks.issueUpdated
resources:
- key: main
path: src/frontend/index.jsx
app:
runtime:
name: nodejs22.x
id: ari:cloud:ecosystem::app/...
permissions:
scopes:
- read:jira-work
I then installed it on my app, ran forge tunnel
and updated an issue. It successfully printed. If you try follow this, can you confirm you are able to see the console logs in your tunnel?
In your current app, can you confirm that the triggers for the other events such as avi:jira:created:issue
work, ie, is this only a problem with avi:jira:updated:issue
?
Okay I tried to create a new application to recreate these steps and retried it multiple times and even used the same manifest minus the id and i’m getting a different error
ERROR 12:09:57.720 1739a37e-560c-459d-bc04-152e1337dd6f TypeError: m[o.functionName] is not a function
at /private/var/folders/f3/qskfpz8s7g71stxk8s3cmvwc0000gn/T/forge-dist-36148-8LD4gvVswzZt/__forge_wrapper__.cjs:2:1105467
at Q (/private/var/folders/f3/qskfpz8s7g71stxk8s3cmvwc0000gn/T/forge-dist-36148-8LD4gvVswzZt/__forge_wrapper__.cjs:2:1105473)
at new Promise (<anonymous>)
at /private/var/folders/f3/qskfpz8s7g71stxk8s3cmvwc0000gn/T/forge-dist-36148-8LD4gvVswzZt/__forge_wrapper__.cjs:2:1105217
at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
at b (/private/var/folders/f3/qskfpz8s7g71stxk8s3cmvwc0000gn/T/forge-dist-36148-8LD4gvVswzZt/__forge_wrapper__.cjs:2:1104445)
at process.<anonymous> (/Users/kingsleytorlowei/.nvm/versions/node/v22.14.0/lib/node_modules/@forge/cli/node_modules/@forge/tunnel/out/sandbox/sandbox-runner.js:11:26)
at process.emit (node:events:518:28)
at emit (node:internal/child_process:949:14)
at process.processTicksAndRejections (node:internal/process/task_queues:91:21)
In my previous application, I see the triggers in my terminal but i can’t see any of the console.logs i have out.
Would you mind getting on a call with me to solve this?
I just deleted my code and did the whole process again and it worked. Not sure what’s different but I’m glad
Great to hear Kayode glad we could help!