Uploaded image for project: 'Atlassian Ecosystem'
  1. Atlassian Ecosystem
  2. ECO-516

Making network requests on Forge can result in sporadic ECONNRESET error

    • Severity 3 - Minor
    • M

      Issue Summary

      When making network requests via a Forge App, developers will sometimes see that these requests fail due to an ECONNRESET error.

      This seems to be a known issue with nodejs, more details here.

      Steps to Reproduce

      1. Create Forge app
      2. Make network request
        1. Developers might need to repeat this step to successfully reproduce the error if using a remote server outside of their domain.

      Expected Results

      The request connection should always successfully be made with the remote server.

      Actual Results

      Occasionally, developers can see that network requests are attempted to be made and a ECONNRESET error is produced.

      Workaround

      While we work on a fix, you can either;

      1. Watch for and retry on ECONNRESET as they are not indicative of a real client or server error and can be retried.
      2. Disable keepalive for network requests made from Forge apps such that a new connection is made each time.
      3. Set the global HTTPS agent using the following code:
        import https from 'https';
        
        https.globalAgent = new https.Agent({ keepalive: false });
        

        For further details, refer to the official documentation. This workaround will apply even to https requests nested inside @forge/events.

            [ECO-516] Making network requests on Forge can result in sporadic ECONNRESET error

            Bo Yang Zhang added a comment - - edited

            Hi,

            We have released a new version of @forge/api which no longer depends on the in built `https` module, which has a bug relating to connection keep-alive.

            If you encounter this issue please upgrade to version 5.X of the @forge/api package.

            In terms of async events, please also upgrade to the latest version of @forge/events, which pulls in the latest version of @forge/api.

            Bo Yang Zhang added a comment - - edited Hi, We have released a new version of @forge/api which no longer depends on the in built `https` module, which has a bug relating to connection keep-alive. If you encounter this issue please upgrade to version 5.X of the @forge/api package. In terms of async events, please also upgrade to the latest version of @forge/events , which pulls in the latest version of @forge/api.

            Hi,
            Are there any updates on this issue? We are also sporadically encountering the ECONNRESET error while using the Async Events API. Unfortunately, the workarounds you mentioned are not applicable in our case, as the fetches are not directly initiated by us but are happening in the background of the events of The Async Events API.

            This issue is critical for us, as it significantly impacts the end-user experience.

            We strongly urge you to prioritize and resolve this problem as soon as possible.
            Thank you.

            Adam Repaský added a comment - Hi, Are there any updates on this issue? We are also sporadically encountering the ECONNRESET error while using the Async Events API. Unfortunately, the workarounds you mentioned are not applicable in our case, as the fetches are not directly initiated by us but are happening in the background of the events of The Async Events API. This issue is critical for us, as it significantly impacts the end-user experience. We strongly urge you to prioritize and resolve this problem as soon as possible. Thank you.

            Hello
            We would like to request that this bug be prioritized for a fix as it critically impacts our application’s reliability. In our case the error seems to originate from the Forge platform itself as we do not explicitly call the /forge/entities/graphql endpoint in our code (we do work with assets, and async events). 

            Given this, applying the suggested workarounds (retry logic and disabling keepAlive) might not be feasible for us, as the source of the error appears to be outside our direct control. Below are the error details we are experiencing:

            FetchError: request to https://stargate/forge/entities/graphql failed, reason: socket hang up at ClientRequest.<anonymous> (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/node-fetch/lib/index.mjs:1495:1) at ClientRequest.emit (node:events:529:35) at TLSSocket.socketCloseListener (node:http_client:474:11) at TLSSocket.emit (node:events:529:35) at node:net:350:12 at TCP.done (node:_tls_wrap:657:7) at TCP.callbackTrampoline (node:internal/async_hooks:128:17) Error type: system Thank you for any efforts to expedite a resolution
            

            Thank you for any efforts to expedite a resolution. 

             

            Martin Fischer added a comment - Hello We would like to request that this bug be prioritized for a fix as it critically impacts our application’s reliability. In our case the error seems to originate from the Forge platform itself as we do not explicitly call the /forge/entities/graphql endpoint in our code (we do work with assets, and async events).  Given this, applying the suggested workarounds (retry logic and disabling keepAlive ) might not be feasible for us, as the source of the error appears to be outside our direct control. Below are the error details we are experiencing: FetchError: request to https: //stargate/forge/entities/graphql failed, reason: socket hang up at ClientRequest.<anonymous> (webpack://jira-service-management-assets- import -type-ui-kit/node_modules/node-fetch/lib/index.mjs:1495:1) at ClientRequest.emit (node:events:529:35) at TLSSocket.socketCloseListener (node:http_client:474:11) at TLSSocket.emit (node:events:529:35) at node:net:350:12 at TCP.done (node:_tls_wrap:657:7) at TCP.callbackTrampoline (node:internal/async_hooks:128:17) Error type: system Thank you for any efforts to expedite a resolution Thank you for any efforts to expedite a resolution.   

              1834277a2369 Bo Yang Zhang
              2ee5b34a48bc Matthew Freeman
              Affected customers:
              9 This affects my team
              Watchers:
              16 Start watching this issue

                Created:
                Updated:
                Resolved: