timeout in javascript sdk not work
const runRequest = await endpoint.run(inputPayload, 600000);
An error occurred: AxiosError: timeout of 3000ms exceeded.
It seems that the timeout setting is not taking effect.
this is the run function in js sdk.
async run(
request: EndpointInputPayload,
timeout: number = 3000
): Promise<EndpointIncompleteOutput> {
return run(this.baseUrl, this.apiKey, this.endpointId, request, timeout)
}
12 Replies
What's the url you're using?
Oh I think it's js or ts problem?
I don't think the JS SDK has been officially released yet, probably stll a work-in-progress.
I use runpod javascript sdk in next.js project, const { RUNPOD_API_KEY, ENDPOINT_ID } = process.env;
const runpod = runpodSdk(RUNPOD_API_KEY);
const endpoint = runpod.endpoint(ENDPOINT_ID);
const runRequest = await endpoint.run(inputPayload, 600000);
This is a terrible idea. NEVER put an API key in a frontend application.
https://docs.runpod.io/sdks/javascript/endpoints Following the documentation, apply this sentence.
Endpoints | RunPod Documentation
Learn how to interact with RunPod's endpoints using the JavaScript SDK, including synchronous and asynchronous execution methods, status checks, and job cancellation. Discover how to set timeouts, execute policies, and purge queues.
const runpod = runpodSdk(RUNPOD_API_KEY);
in my api , in server
That documentation assumes backend not frontend. I think @PatrickR needs to put a warning on that doc otherwise people are going to have their API keys leaked.
My RUNPOD_API_KEY in my server, api route, in .env file , not frontend
Maybe delete the number = 3000 and see if it works
The assignment
just now,I set default number 3000 to 300000, not work,still expeed 3000
Log an issue on the SDK Github repo if its an issue with the SDK.
I see, in index.ts, import { curry, clamp, isNil } from "ramda",but I did not install ramda before. So run = curry () did not work.Now I works.