Fetch ETIMEDOUT after upgrade to CLI 9.0.0 + Solution

Hello,

after updating to new CLI 9.0.0 and updating manifest with app.runtime.name: nodejs18.x fetch to db server stopped working and always ends up with this error:

FetchError: request to https://XX.XX.XX.XX:1234/xyz failed, reason: connect ETIMEDOUT 185.166.143.31:1234
    at ClientRequest.<anonymous> (webpack://jira-global-page-custom-ui/node_modules/@forge/api/node_modules/node-fetch/lib/index.mjs:1494:1)
    at ClientRequest.emit (node:events:529:35)
    at TLSSocket.socketErrorListener (node:_http_client:501:9)
    at TLSSocket.emit (node:events:529:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}

What I find strange is that timeout is on Atlassian server ip with same port as original request.
This happens only on newly deployed app with this CLI version, older seems to still work fine.
Db server is ok and responsive.

So far I tried:

  • downgrading nodejs from 21.something to 18.20.2 (to fit with the app.runtime.name: nodejs18.x),
  • creating new app to just test the fetch
  • removing NODE_TLS_REJECT_UNAUTHORIZED=0
    but nothing seems to have any effect.

SOLUTION:
Before I posted this, I decided to try one more thing and it finally worked. I updated nodejs to 22.0.0 and set app.runtime.name: sandbox. Now all seems to be working like before.

P.S. I posted this in case anyone runs into the same problem, I could not find anything related to this issue.

1 Like

You are a life saver. I was about to upgrade and use node 18 runtime :sweat_smile:

Thanks for the warning :rocket:

Don’t get your hopes high just yet, I just found out that update also broke apps made with old UI Kit :man_facepalming: some elements are not even present in new UI Kit…

I hope you get it fixed :crossed_fingers:
I also have read the macro config UI kit 2 changelog and I am very afraid to adopt new things currently …. Most of the new stuff is partly broken on arrival :sweat_smile:

Thanks, it has been a long day, but I think I managed to make it work again. Good luck to you too! :slight_smile:

1 Like

Hey @LaubeDaniel and @clouless,

Thanks for reporting this. There is currently a restriction on the ports than can be requested from the nodejs18.x runtime: https://developer.atlassian.com/platform/forge/runtime-reference/#https-only.

It seems regardless there may be an issue with specifying ports in general with @forge/api which we will look into.

It would be great if you could open a ticket and upvote it here with your use case around needing additional ports available.

Thanks again.

1 Like

I try the nodejs18.x runtime and it works only for the default HTTPS port. Have we a fix ahead?

Thanks!!