Can't create document with session.createDocument()
ngngoctrung1997 opened this issue · 2 comments
I can't create new document, whenever i try, the error source.on is not a function keep apear
My code:
async createECMDoc(data, fileName, fileType) {
let docId;
let session = new cmis.CmisSession(this.settings.CMIS_URL);
session.setCredentials(this.settings.CMIS_USERNAME, this.settings.CMIS_PASSWORD)
.loadRepositories()
.then(function () {
return session.createDocument("48bc5187-6d77-4980-bf0d-4ccdb0d822ff",
"this is the document content",
"test.txt");
})
.then(data => {
this.logger.info("created document");
docId = data.succinctProperties["cmis:objectId"];
});
return docId;
}
My error:
TypeError: source.on is not a function
at DelayedStream.create (D:\8. Product\HAS Product\03-phat-trien-phan-mem\source\moleculer-template\node_modules\delayed-stream\lib\delayed_stream.js:33:10)
at CombinedStream.append (D:\8. Product\HAS Product\03-phat-trien-phan-mem\source\moleculer-template\node_modules\combined-stream\lib\combined_stream.js:45:37)
at FormData.append (D:\8. Product\HAS Product\03-phat-trien-phan-mem\source\moleculer-template\node_modules\isomorphic-form-data\node_modules\form-data\lib\form_data.js:68:3)
at CmisSession.http (D:\8. Product\HAS Product\03-phat-trien-phan-mem\source\moleculer-template\node_modules\cmis\dist\cmis.js:122:26)
at CmisSession.post (D:\8. Product\HAS Product\03-phat-trien-phan-mem\source\moleculer-template\node_modules\cmis\dist\cmis.js:160:25)
at CmisSession.createDocument (D:\8. Product\HAS Product\03-phat-trien-phan-mem\source\moleculer-template\node_modules\cmis\dist\cmis.js:405:25)
at D:\8. Product\HAS Product\03-phat-trien-phan-mem\source\moleculer-template\services\attachments.service.js:126:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Are you sure that your file content is of type string | Blob | Buffer
?
I have the same problem..
with String I get your error (source.on is not a function) and if I use Buffer I get an HTTP 400 Error with Error Body: {"exception":"invalidArgument","message":"Invalid form encoding!"}
Any ideas?