Skip to content

Conversation

4nche
Copy link

@4nche 4nche commented Aug 21, 2025

if keepalive is set to true in a nodejs environment, the request is not executed. It seems that the keepalive parameter is only available in the browser, maybe better to set it to true only in a browser environment

if keepalive is set to true in a nodejs environment, the request is not executed. It seems that the keepalive parameter is only available in the browser, maybe better to set it to true only in a browser environment

Signed-off-by: anche <[email protected]>
@nktkas
Copy link
Owner

nktkas commented Aug 24, 2025

The keepalive property is supported by NodeJS, starting with the native implementation of fetch.

Also, everything works fine for me in NodeJS

Code example
import * as hl from "@nktkas/hyperliquid";

const infoClient = new hl.InfoClient({
    transport: new hl.HttpTransport(),
});

console.log(await infoClient.allMids().then(() => "true"));
console.log(await infoClient.allMids().then(() => "true"));
console.log(await infoClient.allMids().then(() => "true"));

Can you provide a reproducible example of code and version of the library and nodejs?

@pixelis0x
Copy link

i can confirm that even with node 24 i'm getting this error

@nktkas
Copy link
Owner

nktkas commented Sep 5, 2025

I tested it on NodeJS v24.0.0 + [npm, pnpm, yarn, jsr] package manager, but still couldn't reproduce the error.

Can you describe your development environment in more detail + the code you are running (if it is not similar to what I sent you)?

In the meantime, you can use new hl.HttpTransport({ fetchOptions: { keepalive: false } }) to disable keepalive.

@nktkas
Copy link
Owner

nktkas commented Sep 23, 2025

If anyone else has the same problem and can provide a reproducible example, please post it in Issues.

@nktkas nktkas closed this Sep 23, 2025
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

Successfully merging this pull request may close these issues.

3 participants