Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post middleware causes response to hang for large page sizes #19

Closed
hrc-yu opened this issue Dec 21, 2022 · 1 comment
Closed

Post middleware causes response to hang for large page sizes #19

hrc-yu opened this issue Dec 21, 2022 · 1 comment

Comments

@hrc-yu
Copy link

hrc-yu commented Dec 21, 2022

Issue:

When making a request with a larger page size (for the data set I'm testing with, anything above pageSize: 38), the SDK request hangs if a post middleware is set. It does not seem to matter what is happening in the middleware - just a log statement causes this problem.

The request completes as expected if the page size is set lower. It also completes for a larger page size (up to the API's limit of 100) if no middleware is set.

I am wondering if it's an issue with the use of response.clone() here. I see a potentially related open issue for node-fetch here.

Let me know if you have any suggestions on how to resolve this, or if I can provide more information!

Sample code:

import { Configuration, HRIS } from "@mergeapi/merge-sdk-typescript";
import fetch from "node-fetch";

const post = async () => {
  console.log("post middleware");
};

const apiConfig = new Configuration({
  accessToken: "<redacted>",
  apiKey: "<redacted>",
  basePath: "https://api-eu.merge.dev/api",
  fetchApi: fetch,
  middleware: [{ post }],
});

const api = new HRIS.EmployeesApi(apiConfig);
const response = await api.employeesList({ pageSize: 39 });

Version info:

"@mergeapi/merge-sdk-typescript": "2.0.2"
"node-fetch": "2.6.7"
"node": ">=14.16.1"
@leewang0
Copy link
Contributor

leewang0 commented Feb 9, 2023

This was fixed in 3.0.2

@leewang0 leewang0 closed this as completed Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants