Skip to main content

I’m following this tutorial and hitting an error when I get to step 3.  I’m using the Node.JS SDK and the error I’m getting back is:

 

"status":400,"text":"{\"errorCode\":\"FORMAT_CONVERSION_ERROR\",\"message\":\"The data could not be converted.\"}"

 

I’ve tried many different files, all DOCX, including very simple one-line docs and docs from the sample projects with the same issue.  I can send all these docs as normal envelopes.

 

In the docs here it says:

Document generation is available in all developer accounts

 

However, I don’t see any settings mentioned in this blog post on my account, so I’m wondering if the above is still true.

 

Appreciate any advice/guidance anyone may have, thanks!!

 

In case it helps, the code in question:

 


const documentId = '1';
const docBytes = readFileSync(file.path);
// create the document object
const document = docusign.Document.constructFromObject({
documentBase64: Buffer.from(docBytes).toString('base64'),
name: file.filename,
fileExtension: 'docx',
documentId,
});

const envelopeDefinition = docusign.EnvelopeDefinition.constructFromObject({
documents: :document],
});

await templatesApi.updateDocument(
authInfo.apiAccountId, //defined elsewhere
templateId, //defined elsewhere
documentId,
{
envelopeDefinition: envelopeDefinition,
}
);

 


Could you please check the value of the "file.filename"? If the extension is appended at the end of the name, please remove it. Also, please ensure that you load the docx file. If the file and its fileExtension are different, this error may occur. 
I wasn't able to reproduce the same issue using the below code with my Demo account:


// read file
const docBytes = fs.readFileSync(args.doc2File);

// create the document object
const document = new docusign.Document.constructFromObject({
documentBase64: Buffer.from(docBytes).toString('base64'),
name: 'OfferLetterDemo',
fileExtension: 'docx',
documentId: args.documentId,
});

const envelopeDefinition = docusign.EnvelopeDefinition.constructFromObject({
documents: :document],
});

let templatesApi = new docusign.TemplatesApi(dsApiClient);
await templatesApi.updateDocument(
args.accountId,
args.templateId,
args.documentId,
{ envelopeDefinition }
);

 


Reply