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

How to set IP proxy? Requests to openai easily time out #265

Open
1163996518 opened this issue Jan 4, 2025 · 4 comments
Open

How to set IP proxy? Requests to openai easily time out #265

1163996518 opened this issue Jan 4, 2025 · 4 comments

Comments

@1163996518
Copy link

1163996518 commented Jan 4, 2025

(node:5760) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Processing file 1/3
file:///D:/Program%20Files/nodejs/node_global/node_modules/humanifyjs/node_modules/openai/core.mjs:316
throw new APIConnectionError({ cause: response });
^

APIConnectionError: Connection error.
at OpenAI.makeRequest (file:///D:/Program%20Files/nodejs/node_global/node_modules/humanifyjs/node_modules/openai/core.mjs:316:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async file:///D:/Program%20Files/nodejs/node_global/node_modules/humanifyjs/dist/index.mjs:55216:26
at async visitAllIdentifiers (file:///D:/Program%20Files/nodejs/node_global/node_modules/humanifyjs/dist/index.mjs:55082:21)
at async file:///D:/Program%20Files/nodejs/node_global/node_modules/humanifyjs/dist/index.mjs:55210:12
at async unminify (file:///D:/Program%20Files/nodejs/node_global/node_modules/humanifyjs/dist/index.mjs:172:27)
at async Command. (file:///D:/Program%20Files/nodejs/node_global/node_modules/humanifyjs/dist/index.mjs:55292:3) {
status: undefined,
headers: undefined,
request_id: undefined,
error: undefined,
code: undefined,
param: undefined,
type: undefined,
cause: FetchError: request to https://api.openai.com/v1/chat/completions failed, reason:
at ClientRequest. (D:\Program Files\nodejs\node_global\node_modules\humanifyjs\node_modules\node-fetch\lib\index.js:1501:11)
at ClientRequest.emit (node:events:518:28)
at emitErrorEvent (node:_http_client:103:11)
at TLSSocket.socketErrorListener (node:_http_client:506:5)
at TLSSocket.emit (node:events:530:35)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT'
}
}

@jehna
Copy link
Owner

jehna commented Jan 4, 2025

Do you have an unreliable internet? Would setting a proxy help in this case?

@1163996518
Copy link
Author

Do you have an unreliable internet? Would setting a proxy help in this case?

yes, unreliable internet

@jehna
Copy link
Owner

jehna commented Jan 5, 2025

I'm pretty sure that you can use HTTP_PROXY and HTTPS_PROXY environment variables to set the http proxy. Current undici seems to support it and I'd assume the underlying openai library would be using undici.

@jehna
Copy link
Owner

jehna commented Jan 5, 2025

Hmm, seems that openai is still using node-fetch, so it might not work:

https://github.com/openai/openai-node/blob/f4066e1af907586946a5e6befee9459268425680/README.md?plain=1#L2-L5

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