• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


03 Feb, 2025

Updated at 08 Feb, 2025

Issue with Forge Custom Field Function in Jira App

I'm facing an issue with our Forge app where the function for a read-only custom field is failing. The function is defined in index.js and referenced in manifest.yml, but the app throws a error during execution. I've tried cleaning, redeploying, and debugging with forge tunnel, but the issue persists.

index.js 

 

 

import Resolver from '@forge/resolver';

const resolver = new Resolver();

resolver.define('getAbhi', async (req) => {
  console.log("Function getAbhi was called", req);
  return 'Hello Abhishek';
});

export const handler = resolver.getDefinitions();
manifest.yml

 

modules:
  jira:customField:
    - key: custom-field-hello-world
      name: custom-field-a
      description: A hello world custom field.
      type: string
      validation:
        expression: value == null || !!value.match("^[A-Za-z]+$")
        errorMessage: The value must consist only of letters
      edit:
        resource: main

    - key: editable-custom-field
      name: editable-custom-field
      description: A editable custom field custom field.
      type: string
      validation:
        expression: value == null || !!value.match("^[A-Za-z]+$")
        errorMessage: The value must consist only of letters

    - key: read-only-custom-field
      name: Read-Only-Custom-Field
      description: A Read Only custom field.
      type: string
      function: getAbhi
      readOnly: true
     

    - key: time-since-created
      name: time-since-created
      description: A time since created custom field.
      type: string
      readOnly: true
      resource:
        function: main

  function:
    - key: main
      handler: index.handler  # Same handler as above

resources:
  - key: main
    path: static/hello-world/build  # Ensure this path is correct

permissions:
  content:
    styles:
      - unsafe-inline

app:
  runtime:
    name: nodejs22.x
  id: ari:cloud:ecosystem::app/3917f6af-5993-4f31-b023-f10e7f6341bd
Note : I want to fetch the hello abhishek from index.js and want to show to read-only-custom-field .