Cannot upload file to Assistant V2 Api

I have been unable to upload files to attach to the assistant V2 API. Both the UI and API have the same error message attached to them.

{code: "invalid_file", message: "The file could not be parsed because it is empty."}

If I pipe the readstream directly into a write stream locally I can see the file copy.

const vectorStoreId = 'vs_6cK0scHhg7KzN4Pq1XRAlSQk';
  // const vectorStoreId = vectorStore.id;

  console.log('create read stream');
  const fileResponse = fs.createReadStream('/Users/logo/Downloads/test-report.pdf');

  const write = fs.createWriteStream('./test.pdf');

  console.log('uploading file');
  const resy = await openai.beta.vectorStores.files.uploadAndPoll(vectorStoreId, fileResponse);

  console.log(JSON.stringify(resy, null, 2));
  console.log('finished uploading file');

did you ever solve this? i have the same problem.

you can upload the file using the http api, it will be easier, and you don’t deppend form that lib for that