IBM Support

Known issue in Assist 8.6: When invoking Assist node SDK to upload documents, the file buffer parameter must be Buffer

Troubleshooting


Problem

When you invoke the Assist node SDK to upload documents, the file buffer parameter must be Buffer.

Symptom

This issue occurs when you invoke the method DocumentManagementV1.createDocument to upload documents into Assist collections by using the Assist node SDK equipment-advisor-node-sdk. The parameter file.buffer must be Bufferfs.ReadStream is not an accepted parameter anymore.

Cause

From Maximo Assist 8.6 (MAS 8.9), the request package that is used to send the request to the backend Assist REST APIs is AXIOS. AXIOS does not support Streams, and when you upload documents, the parameter file.buffer must be Buffer.

Assist version impacted:
Assist 8.(MAS 8.9.x)

Resolving The Problem

Pass file.buffer as type of Buffer, rather than fs.ReadStream. Example code in JavaScript:
const SDK = require('equipment-advisor-node-sdk');
const fs = require('fs');
const sdkInst = new SDK({
    endpoint: process.env.SDK_ENDPOINT,
    tenantId:<workspace-id>,
    apiKey: <api-key>});
const testFile = fs.readFileSync('test.pdf');
const file = {
     buffer: testFile,
     originalname: 'test.pdf',
     mimetype: 'application/pdf'};
const params = {
     collectionId: '0e409a70-xxxx-xxxx-xxxx-818ae8bc7c8a',
     file};
sdkInst.DocumentManagementV1.createDocument(params)
     .then(result => {console.log('result:', result);})
     .catch(error => {console.error('error:', error);});

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB59","label":"Sustainability Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSRHPA","label":"IBM Maximo Application Suite"},"ARM Category":[{"code":"a8m3p000000F83HAAS","label":"Maximo Application Suite-\u003EMAS Applications-\u003EAssist"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.9.0"}]

Document Information

Modified date:
22 November 2022

UID

ibm16839095