Hello World - Part 2 Deploy error

I can deploy and install the standard “Hello World” app that is created with “forge create”. But, I can’t deploy the example in “Hello World - Part 2” (the source code doesn’t come through when I attempted to paste it here and I can only attach one file but the source code can be found in https://developer.atlassian.com/platform/forge/call-a-jira-api/).

First, I get this:
error Jira endpoint: GET /rest/api/3/issue/{issueIdOrKey}/comment requires “read:jira-work” scope permission-scope-required
X 1 issue (1 error, 0 warnings)
Run forge lint --fix to automatically fix 1 error and 0 warnings.

Then, after dutifully running “forge lint --fix”, which claims to have fixed the error, I try “forge deploy” again and get a 50 line error message starting with this. The entire error message is attached:

Error: Bundling failed: ./src/index.jsx
Module not found: Error: Can’t resolve ‘@forge/api’ in ‘/Users/debbie/Documents/Jira App Development/hello-world-part-2/src’
resolve ‘@forge/api’ in ‘/Users/debbie/Documents/Jira App Development/hello-world-part-2/src’
Parsed request is a module
using description file: /Users/debbie/Documents/Jira App Development/hello-world-part-2/package.json (relative path: ./src)
Field ‘browser’ doesn’t contain a valid alias configuration
resolve as module
/Users/debbie/Documents/Jira App Development/hello-world-part-2/src/node_modules doesn’t exist or is not a directory

Maybe this is a red-herring, but the [long] error message does seem to complain that /src/node_modules doesn’t exist. Well, “forge create” put “node_modules” directly under the app (“hello-world-part-2”) rather than under /src. Are we supposed to reorganize the folders? If so, the tutorial left out that step.

My environment:

  • iMac running macOS Big Sur, version 11.2.3
  • Node v14.16.0
  • Docker version 20.10.5

This is new to me so I’d appreciate any help or hints. Thanks.

Hey @DEBRASHANNON1,

If you run npm install in your app directory, this should be resolved.

1 Like

Hi @DEBRASHANNON1 ,

I just went through the tutorial myself and had the same issue when I skipped (ups) the first step which adds the @forge/api package to the dependencies in the package.json file.

This command in particular:
npm install @forge/api

It is true that npm install will also resolve the problem, but only if the @forge/api package is already listed in the package.json. This wasn’t the case in my app source code after following the tutorial.

Cheers,
Caterina

2 Likes

Hi @DEBRASHANNON1

The issue is due to some missing permission.

Adding the following lines at the end of your “manifest.yml” file should fix :

permissions:
  scopes:
    - 'read:jira-work'

Cheers,
Seb

2 Likes
permissions:
  scopes:
    - 'read:jira-work'

Worked great for me

Hi Team,

I’m facing the same problem while deploying Hello World App Part 2.

I’ve provided the required permissions, @forge/api is also present in my package.json file, forge/api file is also present in my node_modules. I’ve already run the “npm install @forge/api”, “nmp install -e development” and "npm install"all these commands but still I’m getting the following error.

Please help with this.

Error: Bundling failed: Module not found: Error: Can’t resolve ‘forge/api’ in ‘C:\ASPL\Forge Development\First-App\src’

Error: Bundling failed: Module not found: Error: Can’t resolve ‘forge/api’ in ‘C:\ASPL\Forge Development\First-App\src’
at RuntimeBundler.bundle (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\out\deploy\packager\runtime-bundler.js:27:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async AppPackager.package (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\out\deploy\packager\packager.js:16:31)
at async PackageUploadDeployCommand.execute (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\out\deploy\package-upload-deploy.js:14:76)
at async CommandLineUI.displayProgress (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\node_modules@forge\cli-shared\out\ui\command-line-ui.js:46:28)
at async DeployView.reportDeploymentProgress (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\out\command-line\view\deploy-view.js:79:24) at async DeployController.run (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\out\command-line\controller\deploy-controller.js:172:27)
at async Command.actionProcessor (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\out\command-line\command.js:91:32)
at async Promise.all (index 0)
at async Command.parse (C:\Users\chaud\AppData\Roaming\npm\node_modules@forge\cli\out\command-line\command.js:194:13)