environment: sandbox, have not tried in prod environment
code:
const cvAttachment: Attachment = {filename: fName,
content: fs.createReadStream(fName), contentType: "application/pdf"};
let faxRequest: CreateFaxMessageRequest =
{ to: [{ phoneNumber: coverLetterRequest.toFax }],faxResolution: "High",
coverPageText: "CoverPage Attached", coverIndex: 0,
attachments: [cvAttachment]};
const faxResponse: FaxResponse = await rc.restapi().account()
.extension().fax().post(faxRequest);
error:
Executed 'Functions.Fax340b' (Failed, Id=80b76844-bcf2-4665-a39b-dd5fda1b85c9, Duration=17604ms)
System.Private.CoreLib: Exception while executing function: Functions.Fax340b. System.Private.CoreLib: Result: Failure
Exception: source.on is not a function
Stack: TypeError: source.on is not a function
at DelayedStream.create (/Users/ajaywadhawan/dev/coach-infrastructure/AzureFunctions/node_modules/delayed-stream/lib/delayed_stream.js:33:10)
at CombinedStream.append (/Users/ajaywadhawan/dev/coach-infrastructure/AzureFunctions/node_modules/combined-stream/lib/combined_stream.js:45:37)
at FormData.append (/Users/ajaywadhawan/dev/coach-infrastructure/AzureFunctions/node_modules/form-data/lib/form_data.js:75:3)