Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve 'ApiClient' in '\node_modules\docusign-esign\src' When running SERVER-SIDE #332

Open
sjkcodes opened this issue Aug 15, 2023 · 13 comments
Assignees

Comments

@sjkcodes
Copy link

HI there,

I'm getting Module not found: Can't resolve 'ApiClient' in '\node_modules\docusign-esign\src' from my API route.

I see that this error is normally associated with users trying to run the client from the browser, but my code is definitely server-side.

I'm using NextJS 13.

Anyone else encountering this issue?

@ByungjaeChung
Copy link

I guess the docusign-esign package was damaged so the src/ApiClient file no longer exists. Could you please remove the current package and reinstall the latest version in your application?

@sjkcodes
Copy link
Author

I've confirmed that I'm on the latest version 6.3.0 and the src/ApiClient file exists in node_modules

@ByungjaeChung
Copy link

Based on my knowledge, NextJS is used as a Frontend framework, not a server-side. I found this post that addresses this issue on NextJS official page: https://nextjs.org/docs/messages/module-not-found#the-module-youre-trying-to-import-is-not-installed-in-your-dependencies

Hope this helps!

@romariclaurent
Copy link

Getting the same issue here using next 14. Did you manage to get it work ?

I can confirm that nextjs has the ability the define backend api routes with a nodejs runtime.

@nicolassanmar
Copy link

nicolassanmar commented Nov 1, 2023

I'm using Next and I'm getting this same exact error when migrating from the pages router to the app router.
Importing docusign-esign in the app router (in a route.ts file, which only executes on the server side) causes this Can't resolve 'ApiClient' Did you mean './ApiClient'? error.

I tried this on Next 13 and Next 14 and encountered the same issue on both.

I tried to solve this by fiddling with webpack resolver aliases: (https://webpack.js.org/configuration/resolve/#resolvealias), and was able to make the error change to Can't resolve 'Configuration' or various other modules, but was ultimately unable to make this work. Any help is appreciated

@nicolassanmar
Copy link

I think that the issue might come from these lines of code:

(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['Configuration', 'ApiClient', 'model/AccessCodeFormat', 'model/AccountAddress', 'model/AccountBillingPlan', 'model/AccountBillingPlanResponse', 'model/AccountIdentityInputOption', 'model/AccountIdentityVerificationResponse', 'model/AccountIdentityVerificationStep', 'model/AccountIdentityVerificationWorkflow', 'model/AccountInformation', 'model/AccountMinimumPasswordLength', 'model/AccountNotification', 'model/AccountPasswordExpirePasswordDays', 'model/AccountPasswordLockoutDurationMinutes', 'model/AccountPasswordLockoutDurationType', 'model/AccountPasswordMinimumPasswordAgeDays', 'model/AccountPasswordQuestionsRequired', 'model/AccountPasswordRules', 'model/AccountPasswordStrengthType', 'model/AccountPasswordStrengthTypeOption', 'model/AccountRoleSettings', 'model/AccountSeals', 'model/AccountSettingsInformation', 'model/AccountSharedAccess', 'model/AccountSignature', 'model/AccountSignatureDefinition', 'model/AccountSignatureProvider', 'model/AccountSignatureProviderOption', 'model/AccountSignatureProviders', 'model/AccountSignaturesInformation', 'model/AccountUISettings', 'model/AddOn', 'model/AddressInformation', 'model/AddressInformationInput', 'model/AdminMessage', 'model/Agent', 'model/ApiRequestLog', 'model/ApiRequestLogsResult', 'model/AppStoreProduct', 'model/AppStoreReceipt', 'model/Approve', 'model/AskAnAdmin', 'model/Attachment', 'model/AuthenticationMethod', 'model/AuthenticationStatus', 'model/AuthorizationUser', 'model/BccEmailAddress', 'model/BccEmailArchive', 'model/BccEmailArchiveHistory', 'model/BccEmailArchiveHistoryList', 'model/BccEmailArchiveList', 'model/BillingCharge', 'model/BillingChargeResponse', 'model/BillingDiscount', 'model/BillingEntityInformationResponse', 'model/BillingInvoice', 'model/BillingInvoiceItem', 'model/BillingInvoicesResponse', 'model/BillingInvoicesSummary', 'model/BillingPayment', 'model/BillingPaymentItem', 'model/BillingPaymentRequest', 'model/BillingPaymentResponse', 'model/BillingPaymentsResponse', 'model/BillingPlan', 'model/BillingPlanInformation', 'model/BillingPlanPreview', 'model/BillingPlanResponse', 'model/BillingPlanUpdateResponse', 'model/BillingPlansResponse', 'model/BillingPrice', 'model/Brand', 'model/BrandEmailContent', 'model/BrandLink', 'model/BrandLogos', 'model/BrandRequest', 'model/BrandResourceUrls', 'model/BrandResources', 'model/BrandResourcesList', 'model/BrandsRequest', 'model/BrandsResponse', 'model/BulkEnvelope', 'model/BulkEnvelopeStatus', 'model/BulkProcessRequest', 'model/BulkProcessResponse', 'model/BulkProcessResult', 'model/BulkProcessingListSummaries', 'model/BulkProcessingListSummary', 'model/BulkProcessingLists', 'model/BulkSendBatchActionRequest', 'model/BulkSendBatchError', 'model/BulkSendBatchRequest', 'model/BulkSendBatchStatus', 'model/BulkSendBatchSummaries', 'model/BulkSendBatchSummary', 'model/BulkSendEnvelopesInfo', 'model/BulkSendErrorStatus', 'model/BulkSendRequest', 'model/BulkSendResponse', 'model/BulkSendTestResponse', 'model/BulkSendingCopy', 'model/BulkSendingCopyCustomField', 'model/BulkSendingCopyRecipient', 'model/BulkSendingCopyTab', 'model/BulkSendingList', 'model/BulkSendingListSummaries', 'model/BulkSendingListSummary', 'model/BulksendingCopyDocGenFormField', 'model/CaptiveRecipient', 'model/CaptiveRecipientInformation', 'model/CarbonCopy', 'model/CertifiedDelivery', 'model/Checkbox', 'model/ChunkedUploadPart', 'model/ChunkedUploadRequest', 'model/ChunkedUploadResponse', 'model/CloudStorageProvider', 'model/CloudStorageProviders', 'model/Comment', 'model/CommentHistoryResult', 'model/CommentPublish', 'model/CommentThread', 'model/CommentsPublish', 'model/CommissionCounty', 'model/CommissionExpiration', 'model/CommissionNumber', 'model/CommissionState', 'model/Company', 'model/CompositeTemplate', 'model/ConditionalRecipientRule', 'model/ConditionalRecipientRuleCondition', 'model/ConditionalRecipientRuleFilter', 'model/ConnectConfigResults', 'model/ConnectCustomConfiguration', 'model/ConnectDebugLog', 'model/ConnectDeleteFailureResult', 'model/ConnectEventData', 'model/ConnectFailureFilter', 'model/ConnectFailureResult', 'model/ConnectFailureResults', 'model/ConnectHistoricalEnvelopeRepublish', 'model/ConnectLog', 'model/ConnectLogs', 'model/ConnectOAuthConfig', 'model/ConnectSalesforceField', 'model/ConnectSalesforceObject', 'model/ConnectUserInfo', 'model/ConnectUserObject', 'model/ConsentDetails', 'model/ConsoleViewRequest', 'model/ConsumerDisclosure', 'model/Contact', 'model/ContactGetResponse', 'model/ContactModRequest', 'model/ContactPhoneNumber', 'model/ContactUpdateResponse', 'model/CorrectViewRequest', 'model/Country', 'model/CreditCardInformation', 'model/CreditCardTypes', 'model/CurrencyFeatureSetPrice', 'model/CurrencyPlanPrice', 'model/CustomField', 'model/CustomFields', 'model/CustomFieldsEnvelope', 'model/CustomSettingsInformation', 'model/DateSigned', 'model/DateStampProperties', 'model/Decline', 'model/DelayedRouting', 'model/DelegationInfo', 'model/DiagnosticsSettingsInformation', 'model/DirectDebitProcessorInformation', 'model/DobInformationInput', 'model/DocGenFormField', 'model/DocGenFormFieldRequest', 'model/DocGenFormFieldResponse', 'model/DocGenFormFields', 'model/DocGenSyntaxError', 'model/Document', 'model/DocumentFieldsInformation', 'model/DocumentHtmlCollapsibleDisplaySettings', 'model/DocumentHtmlDefinition', 'model/DocumentHtmlDefinitionOriginal', 'model/DocumentHtmlDefinitionOriginals', 'model/DocumentHtmlDefinitions', 'model/DocumentHtmlDisplayAnchor', 'model/DocumentHtmlDisplaySettings', 'model/DocumentTemplate', 'model/DocumentTemplateList', 'model/DocumentVisibility', 'model/DocumentVisibilityList', 'model/DowngradRequestBillingInfoResponse', 'model/DowngradeBillingPlanInformation', 'model/DowngradePlanUpdateResponse', 'model/DowngradeRequestInformation', 'model/Draw', 'model/ENoteConfiguration', 'model/Editor', 'model/Email', 'model/EmailAddress', 'model/EmailSettings', 'model/Envelope', 'model/EnvelopeAttachment', 'model/EnvelopeAttachmentsRequest', 'model/EnvelopeAttachmentsResult', 'model/EnvelopeAuditEvent', 'model/EnvelopeAuditEventResponse', 'model/EnvelopeCustomMetadata', 'model/EnvelopeDefinition', 'model/EnvelopeDelayRule', 'model/EnvelopeDocument', 'model/EnvelopeDocumentsResult', 'model/EnvelopeEvent', 'model/EnvelopeFormData', 'model/EnvelopeId', 'model/EnvelopeIdsRequest', 'model/EnvelopeMetadata', 'model/EnvelopeNotificationRequest', 'model/EnvelopePublishTransaction', 'model/EnvelopePublishTransactionErrorRollup', 'model/EnvelopePurgeConfiguration', 'model/EnvelopeSummary', 'model/EnvelopeTemplate', 'model/EnvelopeTemplateResults', 'model/EnvelopeTransactionStatus', 'model/EnvelopeTransferRule', 'model/EnvelopeTransferRuleInformation', 'model/EnvelopeTransferRuleRequest', 'model/EnvelopeUpdateSummary', 'model/EnvelopesInformation', 'model/ErrorDetails', 'model/EventNotification', 'model/EventResult', 'model/Expirations', 'model/ExternalDocServiceErrorDetails', 'model/ExternalDocumentSources', 'model/ExternalFile', 'model/ExternalFolder', 'model/ExternalPrimaryAccountRecipientAuthRequirements', 'model/FavoriteTemplatesContentItem', 'model/FavoriteTemplatesInfo', 'model/FeatureAvailableMetadata', 'model/FeatureSet', 'model/FileType', 'model/FileTypeList', 'model/Filter', 'model/FirstName', 'model/Folder', 'model/FolderItemResponse', 'model/FolderItemV2', 'model/FolderItemsResponse', 'model/FolderSharedItem', 'model/FoldersRequest', 'model/FoldersResponse', 'model/ForgottenPasswordInformation', 'model/FormDataItem', 'model/FormulaTab', 'model/FullName', 'model/GraphicsContext', 'model/Group', 'model/GroupInformation', 'model/IdCheckConfiguration', 'model/IdCheckInformationInput', 'model/IdCheckSecurityStep', 'model/IdEvidenceResourceToken', 'model/IdEvidenceViewLink', 'model/InPersonSigner', 'model/InitialHere', 'model/InlineTemplate', 'model/IntegratedConnectUserInfoList', 'model/IntegratedUserInfoList', 'model/Intermediary', 'model/Jurisdiction', 'model/JurisdictionSummary', 'model/LastName', 'model/LinkedExternalPrimaryAccount', 'model/List', 'model/ListCustomField', 'model/ListItem', 'model/LocalePolicy', 'model/LocalePolicyTab', 'model/LockInformation', 'model/LockRequest', 'model/LoginAccount', 'model/LoginInformation', 'model/MatchBox', 'model/MemberGroupSharedItem', 'model/MemberSharedItems', 'model/MergeField', 'model/MobileNotifierConfiguration', 'model/MobileNotifierConfigurationInformation', 'model/ModelDate', 'model/ModelNumber', 'model/Money', 'model/NameValue', 'model/NewAccountDefinition', 'model/NewAccountSummary', 'model/NewUser', 'model/NewUsersDefinition', 'model/NewUsersSummary', 'model/Notarize', 'model/Notary', 'model/NotaryContactDetails', 'model/NotaryHost', 'model/NotaryJournal', 'model/NotaryJournalCredibleWitness', 'model/NotaryJournalList', 'model/NotaryJournalMetaData', 'model/NotaryJurisdiction', 'model/NotaryJurisdictionList', 'model/NotaryRecipient', 'model/NotaryResult', 'model/NotarySeal', 'model/Note', 'model/Notification', 'model/NotificationDefaultSettings', 'model/NotificationDefaults', 'model/Numerical', 'model/OauthAccess', 'model/OfflineAttributes', 'model/Page', 'model/PageImages', 'model/PageRequest', 'model/Participant', 'model/PathExtendedElement', 'model/PayPalLegacySettings', 'model/PaymentDetails', 'model/PaymentGatewayAccount', 'model/PaymentGatewayAccountSetting', 'model/PaymentGatewayAccountsInfo', 'model/PaymentLineItem', 'model/PaymentMethodWithOptions', 'model/PaymentProcessorInformation', 'model/PaymentSignerValues', 'model/PermissionProfile', 'model/PermissionProfileInformation', 'model/PhoneNumber', 'model/PlanInformation', 'model/PolyLine', 'model/PolyLineOverlay', 'model/PowerForm', 'model/PowerFormFormDataEnvelope', 'model/PowerFormFormDataRecipient', 'model/PowerFormRecipient', 'model/PowerFormSendersResponse', 'model/PowerFormsFormDataResponse', 'model/PowerFormsRequest', 'model/PowerFormsResponse', 'model/PrefillFormData', 'model/PrefillTabs', 'model/PropertyMetadata', 'model/Province', 'model/ProvisioningInformation', 'model/PurchasedEnvelopesInformation', 'model/Radio', 'model/RadioGroup', 'model/RecipientAdditionalNotification', 'model/RecipientAttachment', 'model/RecipientDomain', 'model/RecipientEmailNotification', 'model/RecipientEvent', 'model/RecipientFormData', 'model/RecipientGroup', 'model/RecipientIdentityInputOption', 'model/RecipientIdentityPhoneNumber', 'model/RecipientIdentityVerification', 'model/RecipientNamesResponse', 'model/RecipientOption', 'model/RecipientPhoneAuthentication', 'model/RecipientPhoneNumber', 'model/RecipientPreviewRequest', 'model/RecipientProofFile', 'model/RecipientRouting', 'model/RecipientRules', 'model/RecipientSMSAuthentication', 'model/RecipientSignatureInformation', 'model/RecipientSignatureProvider', 'model/RecipientSignatureProviderOptions', 'model/RecipientTokenClientURLs', 'model/RecipientUpdateResponse', 'model/RecipientViewRequest', 'model/Recipients', 'model/RecipientsUpdateSummary', 'model/ReferralInformation', 'model/Reminders', 'model/ResourceInformation', 'model/ReturnUrlRequest', 'model/ScheduledSending', 'model/SealIdentifier', 'model/SealSign', 'model/SeatDiscount', 'model/SenderCompany', 'model/SenderEmailNotifications', 'model/SenderName', 'model/ServerTemplate', 'model/ServiceInformation', 'model/ServiceVersion', 'model/SettingsMetadata', 'model/SharedItem', 'model/SignHere', 'model/SignatureGroup', 'model/SignatureGroupDef', 'model/SignatureProviderRequiredOption', 'model/SignatureType', 'model/SignatureUser', 'model/SignatureUserDef', 'model/Signer', 'model/SignerAttachment', 'model/SignerEmailNotifications', 'model/SigningGroup', 'model/SigningGroupInformation', 'model/SigningGroupUser', 'model/SigningGroupUsers', 'model/SmartContractInformation', 'model/SmartSection', 'model/SmartSectionAnchorPosition', 'model/SmartSectionCollapsibleDisplaySettings', 'model/SmartSectionDisplaySettings', 'model/SocialAccountInformation', 'model/SocialAuthentication', 'model/Ssn', 'model/Ssn4InformationInput', 'model/Ssn9InformationInput', 'model/Stamp', 'model/SupportedLanguages', 'model/TabAccountSettings', 'model/TabGroup', 'model/TabMetadata', 'model/TabMetadataList', 'model/Tabs', 'model/TemplateCustomFields', 'model/TemplateDocumentVisibilityList', 'model/TemplateDocumentsResult', 'model/TemplateInformation', 'model/TemplateMatch', 'model/TemplateNotificationRequest', 'model/TemplateRecipients', 'model/TemplateRole', 'model/TemplateSharedItem', 'model/TemplateSummary', 'model/TemplateTabs', 'model/TemplateUpdateSummary', 'model/Text', 'model/TextCustomField', 'model/Title', 'model/UsageHistory', 'model/UserAccountManagementGranularInformation', 'model/UserAuthorization', 'model/UserAuthorizationCreateRequest', 'model/UserAuthorizationCreateRequestWithId', 'model/UserAuthorizationIdWithStatus', 'model/UserAuthorizationUpdateRequest', 'model/UserAuthorizationWithStatus', 'model/UserAuthorizations', 'model/UserAuthorizationsDeleteRequest', 'model/UserAuthorizationsDeleteResponse', 'model/UserAuthorizationsRequest', 'model/UserAuthorizationsResponse', 'model/UserInfo', 'model/UserInfoList', 'model/UserInformation', 'model/UserInformationList', 'model/UserPasswordInformation', 'model/UserPasswordRules', 'model/UserProfile', 'model/UserSettingsInformation', 'model/UserSharedItem', 'model/UserSignature', 'model/UserSignatureDefinition', 'model/UserSignaturesInformation', 'model/UserSocialIdResult', 'model/UsersResponse', 'model/View', 'model/ViewUrl', 'model/Watermark', 'model/Witness', 'model/Workflow', 'model/WorkflowStep', 'model/Workspace', 'model/WorkspaceFolderContents', 'model/WorkspaceItem', 'model/WorkspaceItemList', 'model/WorkspaceList', 'model/WorkspaceSettings', 'model/WorkspaceUser', 'model/WorkspaceUserAuthorization', 'model/Zip', 'api/AccountsApi', 'api/AuthenticationApi', 'api/BillingApi', 'api/BulkEnvelopesApi', 'api/BulkProcessDataApi', 'api/BulkProcessDataSendApi', 'api/CloudStorageApi', 'api/ConnectApi', 'api/CustomTabsApi', 'api/DiagnosticsApi', 'api/EmailArchiveApi', 'api/EnvelopesApi', 'api/FoldersApi', 'api/GroupsApi', 'api/NotaryApi', 'api/OrganizationsApi', 'api/PowerFormsApi', 'api/SigningGroupsApi', 'api/TemplatesApi', 'api/TrustServiceProvidersApi', 'api/UsersApi', 'api/WorkspacesApi'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('./Configuration'), require('./ApiClient'), require('./model/AccessCodeFormat'), require('./model/AccountAddress'), require('./model/AccountBillingPlan'), require('./model/AccountBillingPlanResponse'), require('./model/AccountIdentityInputOption'), require('./model/AccountIdentityVerificationResponse'), require('./model/AccountIdentityVerificationStep'), require('./model/AccountIdentityVerificationWorkflow'), require('./model/AccountInformation'), require('./model/AccountMinimumPasswordLength'), require('./model/AccountNotification'), require('./model/AccountPasswordExpirePasswordDays'), require('./model/AccountPasswordLockoutDurationMinutes'), require('./model/AccountPasswordLockoutDurationType'), require('./model/AccountPasswordMinimumPasswordAgeDays'), require('./model/AccountPasswordQuestionsRequired'), require('./model/AccountPasswordRules'), require('./model/AccountPasswordStrengthType'), require('./model/AccountPasswordStrengthTypeOption'), require('./model/AccountRoleSettings'), require('./model/AccountSeals'), require('./model/AccountSettingsInformation'), require('./model/AccountSharedAccess'), require('./model/AccountSignature'), require('./model/AccountSignatureDefinition'), require('./model/AccountSignatureProvider'), require('./model/AccountSignatureProviderOption'), require('./model/AccountSignatureProviders'), require('./model/AccountSignaturesInformation'), require('./model/AccountUISettings'), require('./model/AddOn'), require('./model/AddressInformation'), require('./model/AddressInformationInput'), require('./model/AdminMessage'), require('./model/Agent'), require('./model/ApiRequestLog'), require('./model/ApiRequestLogsResult'), require('./model/AppStoreProduct'), require('./model/AppStoreReceipt'), require('./model/Approve'), require('./model/AskAnAdmin'), require('./model/Attachment'), require('./model/AuthenticationMethod'), require('./model/AuthenticationStatus'), require('./model/AuthorizationUser'), require('./model/BccEmailAddress'), require('./model/BccEmailArchive'), require('./model/BccEmailArchiveHistory'), require('./model/BccEmailArchiveHistoryList'), require('./model/BccEmailArchiveList'), require('./model/BillingCharge'), require('./model/BillingChargeResponse'), require('./model/BillingDiscount'), require('./model/BillingEntityInformationResponse'), require('./model/BillingInvoice'), require('./model/BillingInvoiceItem'), require('./model/BillingInvoicesResponse'), require('./model/BillingInvoicesSummary'), require('./model/BillingPayment'), require('./model/BillingPaymentItem'), require('./model/BillingPaymentRequest'), require('./model/BillingPaymentResponse'), require('./model/BillingPaymentsResponse'), require('./model/BillingPlan'), require('./model/BillingPlanInformation'), require('./model/BillingPlanPreview'), require('./model/BillingPlanResponse'), require('./model/BillingPlanUpdateResponse'), require('./model/BillingPlansResponse'), require('./model/BillingPrice'), require('./model/Brand'), require('./model/BrandEmailContent'), require('./model/BrandLink'), require('./model/BrandLogos'), require('./model/BrandRequest'), require('./model/BrandResourceUrls'), require('./model/BrandResources'), require('./model/BrandResourcesList'), require('./model/BrandsRequest'), require('./model/BrandsResponse'), require('./model/BulkEnvelope'), require('./model/BulkEnvelopeStatus'), require('./model/BulkProcessRequest'), require('./model/BulkProcessResponse'), require('./model/BulkProcessResult'), require('./model/BulkProcessingListSummaries'), require('./model/BulkProcessingListSummary'), require('./model/BulkProcessingLists'), require('./model/BulkSendBatchActionRequest'), require('./model/BulkSendBatchError'), require('./model/BulkSendBatchRequest'), require('./model/BulkSendBatchStatus'), require('./model/BulkSendBatchSummaries'), require('./model/BulkSendBatchSummary'), require('./model/BulkSendEnvelopesInfo'), require('./model/BulkSendErrorStatus'), require('./model/BulkSendRequest'), require('./model/BulkSendResponse'), require('./model/BulkSendTestResponse'), require('./model/BulkSendingCopy'), require('./model/BulkSendingCopyCustomField'), require('./model/BulkSendingCopyRecipient'), require('./model/BulkSendingCopyTab'), require('./model/BulkSendingList'), require('./model/BulkSendingListSummaries'), require('./model/BulkSendingListSummary'), require('./model/BulksendingCopyDocGenFormField'), require('./model/CaptiveRecipient'), require('./model/CaptiveRecipientInformation'), require('./model/CarbonCopy'), require('./model/CertifiedDelivery'), require('./model/Checkbox'), require('./model/ChunkedUploadPart'), require('./model/ChunkedUploadRequest'), require('./model/ChunkedUploadResponse'), require('./model/CloudStorageProvider'), require('./model/CloudStorageProviders'), require('./model/Comment'), require('./model/CommentHistoryResult'), require('./model/CommentPublish'), require('./model/CommentThread'), require('./model/CommentsPublish'), require('./model/CommissionCounty'), require('./model/CommissionExpiration'), require('./model/CommissionNumber'), require('./model/CommissionState'), require('./model/Company'), require('./model/CompositeTemplate'), require('./model/ConditionalRecipientRule'), require('./model/ConditionalRecipientRuleCondition'), require('./model/ConditionalRecipientRuleFilter'), require('./model/ConnectConfigResults'), require('./model/ConnectCustomConfiguration'), require('./model/ConnectDebugLog'), require('./model/ConnectDeleteFailureResult'), require('./model/ConnectEventData'), require('./model/ConnectFailureFilter'), require('./model/ConnectFailureResult'), require('./model/ConnectFailureResults'), require('./model/ConnectHistoricalEnvelopeRepublish'), require('./model/ConnectLog'), require('./model/ConnectLogs'), require('./model/ConnectOAuthConfig'), require('./model/ConnectSalesforceField'), require('./model/ConnectSalesforceObject'), require('./model/ConnectUserInfo'), require('./model/ConnectUserObject'), require('./model/ConsentDetails'), require('./model/ConsoleViewRequest'), require('./model/ConsumerDisclosure'), require('./model/Contact'), require('./model/ContactGetResponse'), require('./model/ContactModRequest'), require('./model/ContactPhoneNumber'), require('./model/ContactUpdateResponse'), require('./model/CorrectViewRequest'), require('./model/Country'), require('./model/CreditCardInformation'), require('./model/CreditCardTypes'), require('./model/CurrencyFeatureSetPrice'), require('./model/CurrencyPlanPrice'), require('./model/CustomField'), require('./model/CustomFields'), require('./model/CustomFieldsEnvelope'), require('./model/CustomSettingsInformation'), require('./model/DateSigned'), require('./model/DateStampProperties'), require('./model/Decline'), require('./model/DelayedRouting'), require('./model/DelegationInfo'), require('./model/DiagnosticsSettingsInformation'), require('./model/DirectDebitProcessorInformation'), require('./model/DobInformationInput'), require('./model/DocGenFormField'), require('./model/DocGenFormFieldRequest'), require('./model/DocGenFormFieldResponse'), require('./model/DocGenFormFields'), require('./model/DocGenSyntaxError'), require('./model/Document'), require('./model/DocumentFieldsInformation'), require('./model/DocumentHtmlCollapsibleDisplaySettings'), require('./model/DocumentHtmlDefinition'), require('./model/DocumentHtmlDefinitionOriginal'), require('./model/DocumentHtmlDefinitionOriginals'), require('./model/DocumentHtmlDefinitions'), require('./model/DocumentHtmlDisplayAnchor'), require('./model/DocumentHtmlDisplaySettings'), require('./model/DocumentTemplate'), require('./model/DocumentTemplateList'), require('./model/DocumentVisibility'), require('./model/DocumentVisibilityList'), require('./model/DowngradRequestBillingInfoResponse'), require('./model/DowngradeBillingPlanInformation'), require('./model/DowngradePlanUpdateResponse'), require('./model/DowngradeRequestInformation'), require('./model/Draw'), require('./model/ENoteConfiguration'), require('./model/Editor'), require('./model/Email'), require('./model/EmailAddress'), require('./model/EmailSettings'), require('./model/Envelope'), require('./model/EnvelopeAttachment'), require('./model/EnvelopeAttachmentsRequest'), require('./model/EnvelopeAttachmentsResult'), require('./model/EnvelopeAuditEvent'), require('./model/EnvelopeAuditEventResponse'), require('./model/EnvelopeCustomMetadata'), require('./model/EnvelopeDefinition'), require('./model/EnvelopeDelayRule'), require('./model/EnvelopeDocument'), require('./model/EnvelopeDocumentsResult'), require('./model/EnvelopeEvent'), require('./model/EnvelopeFormData'), require('./model/EnvelopeId'), require('./model/EnvelopeIdsRequest'), require('./model/EnvelopeMetadata'), require('./model/EnvelopeNotificationRequest'), require('./model/EnvelopePublishTransaction'), require('./model/EnvelopePublishTransactionErrorRollup'), require('./model/EnvelopePurgeConfiguration'), require('./model/EnvelopeSummary'), require('./model/EnvelopeTemplate'), require('./model/EnvelopeTemplateResults'), require('./model/EnvelopeTransactionStatus'), require('./model/EnvelopeTransferRule'), require('./model/EnvelopeTransferRuleInformation'), require('./model/EnvelopeTransferRuleRequest'), require('./model/EnvelopeUpdateSummary'), require('./model/EnvelopesInformation'), require('./model/ErrorDetails'), require('./model/EventNotification'), require('./model/EventResult'), require('./model/Expirations'), require('./model/ExternalDocServiceErrorDetails'), require('./model/ExternalDocumentSources'), require('./model/ExternalFile'), require('./model/ExternalFolder'), require('./model/ExternalPrimaryAccountRecipientAuthRequirements'), require('./model/FavoriteTemplatesContentItem'), require('./model/FavoriteTemplatesInfo'), require('./model/FeatureAvailableMetadata'), require('./model/FeatureSet'), require('./model/FileType'), require('./model/FileTypeList'), require('./model/Filter'), require('./model/FirstName'), require('./model/Folder'), require('./model/FolderItemResponse'), require('./model/FolderItemV2'), require('./model/FolderItemsResponse'), require('./model/FolderSharedItem'), require('./model/FoldersRequest'), require('./model/FoldersResponse'), require('./model/ForgottenPasswordInformation'), require('./model/FormDataItem'), require('./model/FormulaTab'), require('./model/FullName'), require('./model/GraphicsContext'), require('./model/Group'), require('./model/GroupInformation'), require('./model/IdCheckConfiguration'), require('./model/IdCheckInformationInput'), require('./model/IdCheckSecurityStep'), require('./model/IdEvidenceResourceToken'), require('./model/IdEvidenceViewLink'), require('./model/InPersonSigner'), require('./model/InitialHere'), require('./model/InlineTemplate'), require('./model/IntegratedConnectUserInfoList'), require('./model/IntegratedUserInfoList'), require('./model/Intermediary'), require('./model/Jurisdiction'), require('./model/JurisdictionSummary'), require('./model/LastName'), require('./model/LinkedExternalPrimaryAccount'), require('./model/List'), require('./model/ListCustomField'), require('./model/ListItem'), require('./model/LocalePolicy'), require('./model/LocalePolicyTab'), require('./model/LockInformation'), require('./model/LockRequest'), require('./model/LoginAccount'), require('./model/LoginInformation'), require('./model/MatchBox'), require('./model/MemberGroupSharedItem'), require('./model/MemberSharedItems'), require('./model/MergeField'), require('./model/MobileNotifierConfiguration'), require('./model/MobileNotifierConfigurationInformation'), require('./model/ModelDate'), require('./model/ModelNumber'), require('./model/Money'), require('./model/NameValue'), require('./model/NewAccountDefinition'), require('./model/NewAccountSummary'), require('./model/NewUser'), require('./model/NewUsersDefinition'), require('./model/NewUsersSummary'), require('./model/Notarize'), require('./model/Notary'), require('./model/NotaryContactDetails'), require('./model/NotaryHost'), require('./model/NotaryJournal'), require('./model/NotaryJournalCredibleWitness'), require('./model/NotaryJournalList'), require('./model/NotaryJournalMetaData'), require('./model/NotaryJurisdiction'), require('./model/NotaryJurisdictionList'), require('./model/NotaryRecipient'), require('./model/NotaryResult'), require('./model/NotarySeal'), require('./model/Note'), require('./model/Notification'), require('./model/NotificationDefaultSettings'), require('./model/NotificationDefaults'), require('./model/Numerical'), require('./model/OauthAccess'), require('./model/OfflineAttributes'), require('./model/Page'), require('./model/PageImages'), require('./model/PageRequest'), require('./model/Participant'), require('./model/PathExtendedElement'), require('./model/PayPalLegacySettings'), require('./model/PaymentDetails'), require('./model/PaymentGatewayAccount'), require('./model/PaymentGatewayAccountSetting'), require('./model/PaymentGatewayAccountsInfo'), require('./model/PaymentLineItem'), require('./model/PaymentMethodWithOptions'), require('./model/PaymentProcessorInformation'), require('./model/PaymentSignerValues'), require('./model/PermissionProfile'), require('./model/PermissionProfileInformation'), require('./model/PhoneNumber'), require('./model/PlanInformation'), require('./model/PolyLine'), require('./model/PolyLineOverlay'), require('./model/PowerForm'), require('./model/PowerFormFormDataEnvelope'), require('./model/PowerFormFormDataRecipient'), require('./model/PowerFormRecipient'), require('./model/PowerFormSendersResponse'), require('./model/PowerFormsFormDataResponse'), require('./model/PowerFormsRequest'), require('./model/PowerFormsResponse'), require('./model/PrefillFormData'), require('./model/PrefillTabs'), require('./model/PropertyMetadata'), require('./model/Province'), require('./model/ProvisioningInformation'), require('./model/PurchasedEnvelopesInformation'), require('./model/Radio'), require('./model/RadioGroup'), require('./model/RecipientAdditionalNotification'), require('./model/RecipientAttachment'), require('./model/RecipientDomain'), require('./model/RecipientEmailNotification'), require('./model/RecipientEvent'), require('./model/RecipientFormData'), require('./model/RecipientGroup'), require('./model/RecipientIdentityInputOption'), require('./model/RecipientIdentityPhoneNumber'), require('./model/RecipientIdentityVerification'), require('./model/RecipientNamesResponse'), require('./model/RecipientOption'), require('./model/RecipientPhoneAuthentication'), require('./model/RecipientPhoneNumber'), require('./model/RecipientPreviewRequest'), require('./model/RecipientProofFile'), require('./model/RecipientRouting'), require('./model/RecipientRules'), require('./model/RecipientSMSAuthentication'), require('./model/RecipientSignatureInformation'), require('./model/RecipientSignatureProvider'), require('./model/RecipientSignatureProviderOptions'), require('./model/RecipientTokenClientURLs'), require('./model/RecipientUpdateResponse'), require('./model/RecipientViewRequest'), require('./model/Recipients'), require('./model/RecipientsUpdateSummary'), require('./model/ReferralInformation'), require('./model/Reminders'), require('./model/ResourceInformation'), require('./model/ReturnUrlRequest'), require('./model/ScheduledSending'), require('./model/SealIdentifier'), require('./model/SealSign'), require('./model/SeatDiscount'), require('./model/SenderCompany'), require('./model/SenderEmailNotifications'), require('./model/SenderName'), require('./model/ServerTemplate'), require('./model/ServiceInformation'), require('./model/ServiceVersion'), require('./model/SettingsMetadata'), require('./model/SharedItem'), require('./model/SignHere'), require('./model/SignatureGroup'), require('./model/SignatureGroupDef'), require('./model/SignatureProviderRequiredOption'), require('./model/SignatureType'), require('./model/SignatureUser'), require('./model/SignatureUserDef'), require('./model/Signer'), require('./model/SignerAttachment'), require('./model/SignerEmailNotifications'), require('./model/SigningGroup'), require('./model/SigningGroupInformation'), require('./model/SigningGroupUser'), require('./model/SigningGroupUsers'), require('./model/SmartContractInformation'), require('./model/SmartSection'), require('./model/SmartSectionAnchorPosition'), require('./model/SmartSectionCollapsibleDisplaySettings'), require('./model/SmartSectionDisplaySettings'), require('./model/SocialAccountInformation'), require('./model/SocialAuthentication'), require('./model/Ssn'), require('./model/Ssn4InformationInput'), require('./model/Ssn9InformationInput'), require('./model/Stamp'), require('./model/SupportedLanguages'), require('./model/TabAccountSettings'), require('./model/TabGroup'), require('./model/TabMetadata'), require('./model/TabMetadataList'), require('./model/Tabs'), require('./model/TemplateCustomFields'), require('./model/TemplateDocumentVisibilityList'), require('./model/TemplateDocumentsResult'), require('./model/TemplateInformation'), require('./model/TemplateMatch'), require('./model/TemplateNotificationRequest'), require('./model/TemplateRecipients'), require('./model/TemplateRole'), require('./model/TemplateSharedItem'), require('./model/TemplateSummary'), require('./model/TemplateTabs'), require('./model/TemplateUpdateSummary'), require('./model/Text'), require('./model/TextCustomField'), require('./model/Title'), require('./model/UsageHistory'), require('./model/UserAccountManagementGranularInformation'), require('./model/UserAuthorization'), require('./model/UserAuthorizationCreateRequest'), require('./model/UserAuthorizationCreateRequestWithId'), require('./model/UserAuthorizationIdWithStatus'), require('./model/UserAuthorizationUpdateRequest'), require('./model/UserAuthorizationWithStatus'), require('./model/UserAuthorizations'), require('./model/UserAuthorizationsDeleteRequest'), require('./model/UserAuthorizationsDeleteResponse'), require('./model/UserAuthorizationsRequest'), require('./model/UserAuthorizationsResponse'), require('./model/UserInfo'), require('./model/UserInfoList'), require('./model/UserInformation'), require('./model/UserInformationList'), require('./model/UserPasswordInformation'), require('./model/UserPasswordRules'), require('./model/UserProfile'), require('./model/UserSettingsInformation'), require('./model/UserSharedItem'), require('./model/UserSignature'), require('./model/UserSignatureDefinition'), require('./model/UserSignaturesInformation'), require('./model/UserSocialIdResult'), require('./model/UsersResponse'), require('./model/View'), require('./model/ViewUrl'), require('./model/Watermark'), require('./model/Witness'), require('./model/Workflow'), require('./model/WorkflowStep'), require('./model/Workspace'), require('./model/WorkspaceFolderContents'), require('./model/WorkspaceItem'), require('./model/WorkspaceItemList'), require('./model/WorkspaceList'), require('./model/WorkspaceSettings'), require('./model/WorkspaceUser'), require('./model/WorkspaceUserAuthorization'), require('./model/Zip'), require('./api/AccountsApi'), require('./api/AuthenticationApi'), require('./api/BillingApi'), require('./api/BulkEnvelopesApi'), require('./api/BulkProcessDataApi'), require('./api/BulkProcessDataSendApi'), require('./api/CloudStorageApi'), require('./api/ConnectApi'), require('./api/CustomTabsApi'), require('./api/DiagnosticsApi'), require('./api/EmailArchiveApi'), require('./api/EnvelopesApi'), require('./api/FoldersApi'), require('./api/GroupsApi'), require('./api/NotaryApi'), require('./api/OrganizationsApi'), require('./api/PowerFormsApi'), require('./api/SigningGroupsApi'), require('./api/TemplatesApi'), require('./api/TrustServiceProvidersApi'), require('./api/UsersApi'), require('./api/WorkspacesApi'));
}

I'm not really sure, but I think that in the pages router the else if condition gets executed (which works), while the if condition gets executed on the app router (which does not work)

@nicolassanmar
Copy link

@sjkcodes @romariclaurent I was able to fix this by adding the following to the next.config.js file:

module.exports = {
      ...
      experimental: {
        serverComponentsExternalPackages: ['docusign-esign'],
      },
}

Unfortunately, now I'm getting other errors that are preventing me from migrating to the app router, but might fix your problem!

@thutter
Copy link

thutter commented Feb 27, 2024

Same issue here with Next.js 14 using pages router.

@renanadstest
Copy link

As @nicolassanmar added in Nov 7th answer serverComponentsExternalPackages should be provided in your next.config.js in case you want to use our SDK with Next.js. Don't forget to import docusign-esign library with require (CommonJS) not with import (ESM). More can be seen in Next.js documentation about this option.

@jamespdaubert
Copy link

I followed what nicolassanmar said above:

@sjkcodes @romariclaurent I was able to fix this by adding the following to the next.config.js file:

module.exports = {
      ...
      experimental: {
        serverComponentsExternalPackages: ['docusign-esign'],
      },
}

Unfortunately, now I'm getting other errors that are preventing me from migrating to the app router, but might fix your problem!

And also had "other errors" -- namely, when running npm run build it would fail on linting (after successfully compiling). Changing my import statement from

import docusign from 'docusign-esign';

to

const docusign = require('docusign-esign');

fixed it and got my code compiling, as renanadstest suggested above.

@sonawane-sanket
Copy link
Contributor

Thanks, @nicolassanmar, for providing a solution here! I really appreciate your help in resolving this issue for our SDK users.

@sjkcodes @romariclaurent, can you please confirm if you've been able to resolve the issue you were facing, or are you still encountering problems?

@jamespdaubert
Copy link

@sonawane-sanket I am no longer facing issues after adding the above. However, at the very least, I think documentation should be updated to reflect this limitation. This solution was difficult to track down, and without finding it, I would not have been able to use DocuSign with NextJS.

@arheinjohnson
Copy link

I am facing this issue as well, can the documentation be updated to help us understand how to write a NextJS API route that uses docusign-esign? This is still unclear to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants