INFO 16:07:14.426 ab72e692-8a7f-4da5-8564-81bc8f1b885f REQUEST: POST [object Object] {"expression":"issues.reduce((acc, i) => acc.set(i.attachments.length+'', (acc[i.attachments.length+''] || []).concat(i.id)), {})","context":{"issues":{"jql":{"query":"order by id","startAt":0,"maxResults":1000}}}}
ERROR 16:07:14.904 ab72e692-8a7f-4da5-8564-81bc8f1b885f FetchError: invalid json response body at https://jira/rest/api/2/expression/eval reason: Unexpected end of JSON input
at <anonymous> (webpack://jira-custom-field-ui-kit-2/node_modules/node-fetch/lib/index.mjs:267:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.setUpAttachmentCount (webpack://jira-custom-field-ui-kit-2/src/attachments.js:20:1)
at async /tmp/tunnel-563429-mfUk0COR6kbp/attachments.cjs:2:511617
at async process.<anonymous> (/home/anders/.nvm/versions/node/v20.17.0/lib/node_modules/@forge/cli/node_modules/@forge/tunnel/out/sandbox/sandbox-runner.js:7:20) {
type: 'invalid-json'
}
Does anyone have an idea to what I am doing wrong?
ERROR 16:13:19.240 xxxxx-xxxx-xxxxxx FetchError: invalid json response body at https://forge-outbound-proxy.services.atlassian.com/fpp/provider/app/remote/bitbucket reason: Unexpected token 'P', "Proxy Auth"... is not valid JSON
at <anonymous> (webpack://product-trigger/node_modules/node-fetch/lib/index.mjs:267:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at addComment (webpack://product-trigger/src/index.jsx:22:1)
at Object.run (webpack://product-trigger/src/index.jsx:28:1)
at async /private/var/folders/_6/811c1kx57tj6lmr_cw3l9lm40000gn/T/tunnel-87660-MRcn3EnYPj7h/index.cjs:2:511617
at async process.<anonymous> (/usr/local/lib/node_modules/@forge/cli/node_modules/@forge/tunnel/out/sandbox/sandbox-runner.js:7:20) {
type: 'invalid-json'
}
Since the example you were looking at works with attachments, your app might have run into an egress permission issue for the URL associated with attachments. Per the Forge changelog, Forge was updated in October so that apps now automatically have egress permission to the attachments URL.
Try this:
Pick up the latest version of the Forge CLI with npm install -g @forge/cli@latest
Get the latest Forge API package, from your app’s root folder, with npm install @forge/api@latest
If your manifest still uses the old sandbox runtime, you may also need to update the app entry in it to the latest runtime, as follows: