jsforce / jsforce/jsforce

Performance issues with connection::request() with HTTP 500 status, delays up to 16 seconds

Open
#1,702 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
TypeScript
Stars
1.5k
Forks
551
Avg merge
9h 2m
Merged PRs (30d)
3

Description

Hi,

I recently faced an issue while doing requests of the following way:

 const requestOptions: HttpRequest = {
      method: 'GET',
      url: `/services/apexrest/website/some-apex-endpoint/${data-id}`,
      headers: {
        'content-type': 'application/json',
      }
    };

   // ...... some code
 const response = await conn.request(requestOptions);

If some-apex-endpoint returns a HTTP 500, the request() call can take up to 16 seconds to return. Adding the option { responseType: 'text' }has had no effect on reducing the execution time.

Replacing the code with a regular Javascript fetch() has reduced the execution back to a more sensible 200 ms average execution time.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the delay through the conn.request() entry point with an HTTP 500 response, then compare it with the reported fetch() behavior. Inspect the request implementation and determine what causes the excess wait; done means HTTP 500 responses return without the reported delay. No file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.