Forge lint error

Hi there!
can anyone help here ?

error    function handler property ‘src/index.handler’ cannot find associated file with name ‘src/index.[jt](s%7Csx)’  valid-module-required

`PS D:\Kamran\hackathone\commit-quality-enforcer> tree /F`
`Folder PATH listing for volume New Volume`
`Volume serial number is CE97-033D`
`D:.`
`│   .eslintrc`
`│   .gitignore`
`│   AGENTS.md`
`│   manifest.yml`
`│   package-lock.json`
`│   package.json`
`│   README.md`
`│`
`├───node_modules`
`├───src`
`│   │   index.js`
`│   │`
`│   └───frontend`
`│           index.html`
`│`
`└───static`
`└───hello-world`
`│   .gitignore`
`│   package-lock.json`
`│   package.json`
`│`
`├───public`
`│       index.html`
`│`
`└───src`
`App.js // this is inside src`
`index.js // this is inside src`

my manifest.yml

modules:

function:
- key: backend-resolver
  handler: index.js

jira:command:
- key: commit-quality-enforcer-modal-command-with-shortcut
  title: Commit Quality Enforcer
  shortcut: e t
  target:
    resource: main
  resolver:
    function: backend-resolver


resources:

* key: main
  path: static/hello-world/build

permissions:
scopes:
- read:jira-work

app:
runtime:
name: nodejs20.x
id: some_id

index.js

const Resolver = require(‘@forgeforge/resolver’);

const api = require(‘@forge/api’);

const { route } = api;

const resolver = new Resolver();

resolver.define(‘validateCommit’, async ({ context }) => {

const issueKey = context.extension.issue.key;

const issueRes = await api.asApp().requestJira(route\`/rest/api/3/issue/${issueKey}\`);

const issue = await issueRes.json();

return {

issueKey,
summary: issue.fields.summary,
commitMessageScore: 82,
verdict: 'Good commit message',
suggestedNextStatus: 'In Review',

};

});

module.exports.handler = resolver.getDefinitions();

package.json

{

“name”: “jira-command-custom-ui-static”,

“version”: “0.1.61”,

“private”: true,

“homepage”: “.”,

“dependencies”: {


"@atlaskit/css-reset": "^6.6.2",

"@forge/bridge": "5.10.1",

"react": "^16",

"react-dom": "^16"

},

“devDependencies”: {

"react-scripts": "^5.0.1"

},

“scripts”: {

"start": "react-scripts start",

"build": "react-scripts build",

"eject": "react-scripts eject"

},

“browserslist”: {

"production": \[

  ">0.2%",

  "not dead",

  "not op_mini all"

\],

"development": \[

  "last 1 chrome version",

  "last 1 firefox version",

  "last 1 safari version"

\]

}

}

Welcome to the Atlassian Developer Community, @MuhammadKamran!

At first glance, I find this function handler definition incorrect.

Instead of index.js, you need to use index.handler since that is the one you exported inside src/index.js. This should give a different error, but try this one first.

With this, do you mean inside static/helloworld ant not src?

Cheers,
Ian

1 Like

@ianRagudo At first thank you so much, it worked after i updated handler definition inside the manifest.yml.

But if any one faces this error, he/she must installed the the latest forge version. And must restart his system.

1 Like