4039error but functional on postman .copy postman code and paste it on project dont work

err Error: connect ETIMEDOUT 199.59.149.231:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '199.59.149.231',
  port: 443,
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [Function: httpAdapter],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'multipart/form-data; boundary=--------------------------446307528025305509327261',
      'User-Agent': 'OpenAI/NodeJS/3.2.1',
      Authorization: 'Bearer ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■0WNzIMWV'
    },
    method: 'post',
    data: FormData {
      _overheadLength: 272,
      _valueLength: 9,
      _valuesToMeasure: [Array],
      writable: false,
      readable: true,
      dataSize: 0,
      maxDataSize: 2097152,
      pauseStreams: true,
      _released: true,
      _streams: [],
      _currentStream: null,
      _insideLoop: false,
      _pendingNext: false,
      _boundary: '--------------------------446307528025305509327261',
      _events: [Object: null prototype],
      _eventsCount: 1
    },
    url: 'https://api.openai.com/v1/files'
  },
  request: <ref *1> Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      constructed: true,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false,
      closeEmitted: false,
      [Symbol(kOnFinished)]: []
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError],
      socket: [Function: handleRequestSocket]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'https:',
      path: '/v1/files',
      method: 'POST',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: 'api.openai.com',
      port: null,
      nativeProtocols: [Object],
      pathname: '/v1/files'
    },
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 22924,
    _requestBodyBuffers: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: true,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
    },
    _currentUrl: 'https://api.openai.com/v1/files',
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

but before you start . i can ping through postman on this particular handler.
and the on running project on server is functional .
i dont understand .there must be something wrong with my project, i just can\t figure out why .

the function look like this :

    async uploadFile(prompt) {
        return await openai.createFile(
            fs.createReadStream(path.join(__dirname, "../file/demo.jsonl")),
            "fine-tune"
        );
    }
const openai = require('../util/gpt');
const { Configuration, OpenAIApi } = require("openai");
require('dotenv').config();
const configuration = new Configuration({
    apiKey: "** right key here**"
});
const openai = new OpenAIApi(configuration);

module.exports = openai

“If you live in china, you bomb!If you use vpn, you bomb! If you have both, you bomb bomb bomb!” from your sincerely cloudflare

1 Like

what bothers me most right now is the downFile request .
this request back with the code of 400 or 403. its confuseing

ive figured out what happened . i use vpn . it works .american point .but .the only reason why i cant ping through in my project . is because the options
.yes
the options
the openai request have three params :
the possible string of query or upload .
the possible string if youare going to fine-tune using this request.
the options : options?: AxiosRequestConfig
this particular object have a param called the proxy
[proxy]
proxy can be add as a development choice .
since the product on Ali-server have their own proxy.
they wont be needing this.
but if you are using vpn and sending this request from your localhost on your webStorm/vscode/idea/eclipse . its vital to write a proxy .
the proxy write as follows:

        await openai.deleteFile(fileId
            , axiosConfig
        )
const axiosConfig = isProd ? {} : config.axiosConfig
    axiosConfig: {
        proxy: {
            host: "127.0.0.1", port: 7890, protocol: "socks5"
        }
    }

solved by me hahaha in my team .
hahahhah
ok
have fun haking

我搞清楚是怎么回事了,不是因为什么vpn的问题,而是因为我挂了vpn,但是我的本地工程不知道,我需要为它指定一下vpn代理,它才能通过该vpn给我的代理去翻墙。不然翻不过去,具体看英文

您的代码不全,代理部分isProd 、config、axiosConfig,都怎么用的?