docusign-esign-node-client: Module not found: Can't resolve 'ApiClient' in '\node_modules\docusign-esign\src' When running SERVER-SIDE
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?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 7
- Comments: 15 (1 by maintainers)
@sjkcodes @romariclaurent I was able to fix this by adding the following to the
next.config.jsfile:Unfortunately, now I’m getting other errors that are preventing me from migrating to the app router, but might fix your problem!
As @nicolassanmar added in Nov 7th answer
serverComponentsExternalPackagesshould be provided in yournext.config.jsin case you want to use our SDK with Next.js. Don’t forget to importdocusign-esignlibrary withrequire(CommonJS) not withimport(ESM). More can be seen in Next.js documentation about this option.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!
I followed what nicolassanmar said above:
And also had “other errors” – namely, when running
npm run buildit would fail on linting (after successfully compiling). Changing my import statement fromto
fixed it and got my code compiling, as renanadstest suggested above.
This worked for me