The browser (or proxy) sent a request that this server could not understand

Anyone experience this issue using openai typescript package?

I keep getting “The browser (or proxy) sent a request that this server could not understand” in my AWS lambda.

Here is the code in the lambda to upload the file.

   fs.writeFileSync(
          '/tmp/test.jsonl',
          '{"prompt":"1 ->","completion":" yes\n"}\n{"prompt":"2 ->","completion":" no\n"}',
          {
            encoding: 'utf-8',
          },
        );
        const fff = fs.readFileSync('/tmp/test.jsonl');
        result = await openai.createFile(fff, 'fine-tune', {
          transformRequest: [
            ...curTrans,
            (data, headers) => {
              console.log('HW:uploadFile: request = ', data, headers);
              return data;
            },
          ],
        });

I create the same content on my local and I am able to upload it using curl. Here is the file on my local.

{“prompt”:“1 ->”,“completion”:" yes\n"}
{“prompt”:“2 ->”,“completion”:" no\n"}

Here is the request data & headers in the axios

data : {
  _overheadLength: 249,
  _valueLength: 85,
  _valuesToMeasure: [],
  writable: false,
  readable: true,
  dataSize: 0,
  maxDataSize: 2097152,
  pauseStreams: true,
  _released: false,
  _streams: [
    '----------------------------956356429435769775739863\r\n' +
      'Content-Disposition: form-data; name="file"\r\n' +
      'Content-Type: application/octet-stream\r\n' +
      '\r\n',
    <Buffer 7b 22 70 72 6f 6d 70 74 22 3a 22 31 20 2d 3e 22 2c 22 63 6f 6d 70 6c 65 74 69 6f 6e 22 3a 22 20 79 65 73 0a 22 7d 0a 7b 22 70 72 6f 6d 70 74 22 3a 22 ... 26 more bytes>,
    [Function: bound ],
    '----------------------------956356429435769775739863\r\n' +
      'Content-Disposition: form-data; name="purpose"\r\n' +
      '\r\n',
    'fine-tune',
    [Function: bound ]
  ],
  _currentStream: null,
  _insideLoop: false,
  _pendingNext: false,
  _boundary: '--------------------------956356429435769775739863'
}

headers:  {
  common: { Accept: 'application/json, text/plain, */*' },
  delete: {},
  get: {},
  head: {},
  post: { 'Content-Type': 'application/x-www-form-urlencoded' },
  put: { 'Content-Type': 'application/x-www-form-urlencoded' },
  patch: { 'Content-Type': 'application/x-www-form-urlencoded' },
  'Content-Type': 'multipart/form-data; boundary=--------------------------956356429435769775739863',
  'User-Agent': 'OpenAI/NodeJS/3.0.0',
  Authorization: 'Bearer ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■bPUEtR3x'
}