Hello there,
I got stuck when I am trying to integrate docusign-esign node module in my spfx webpart.
- I’ve created a new spfx webpart
- I’ve installed docusign-esign module in the working directory. (My webpart package.json has the following entry… "docusign-esign": "^8.5.0
Error When I gulp serve - I am getting the following , one of so many.: 'dist':
./node_modules/docusign-esign/src/index.js: Module not found: Error: Can't resolve 'ApiClient' in 'C:\Phani\Custom Development\PembinaApprovalsDashboard\PembinaApprovalsDashboard\node_modules\docusign-esign\src'
Did you mean './ApiClient'?
On init of my webpart, I’ve the following code.
try
{
let dsApiClient = new docusign.ApiClient();
dsApiClient.setOAuthBasePath(this.DOCUSIGN_OAUTH_BASE_PATH);
// Use Buffer.from for DocuSign API compatibility
const privateKeyBuffer = Buffer.from(DOCUSIGN_RSA_PRIVATE_KEY, 'utf8');
const results = await dsApiClient.requestJWTUserToken(
this.DOCUSIGN_INTEGRATION_KEY,
this.DOCUSIGN_USER_ID,
this.DOCUSIGN_SCOPES,
privateKeyBuffer,
3600
);
this.accessToken = results.body.access_token;
console.log("DocuSign Access Token: " + this.accessToken);
}
catch (error) {
if (error.response && error.response.body) {
const errorBody = JSON.parse(error.response.body);
if (errorBody.error === 'consent_required') {
console.log('Consent is required. Please visit the following URL to grant consent:');
console.log(this.consentUrl);
} else {
console.error('Error obtaining JWT user token:', errorBody);
}
}
}
Back to Docusign.com


