Proxy-man not found in production build
Closed this issue · 1 comments
trevordebard commented
- I have checked that the [SDK documentation][sdk-docs] doesn't solve my issue.
- I have checked that the [API documentation][api-docs] doesn't solve my issue.
- I have searched the [Box Developer Forums][dev-forums] and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
- I have searched [Issues in this repo][github-repo] and my issue isn't already reported.
Description of the Issue
When running a production Next.js application that uses the SDK, I receive an error indicating the box sdk cannot access proxy-agent.
The app works fine in development mode but fails after bundling the application into a production Docker container.
I am using a developer token for authentication and testing against the uploadBigFile function. As mentioned, this works successfully in development, but not in a production build. I've tested adding proxy-man to package.json directly but the issue is not resolved.
Error Message, Including Stack Trace
▲ Next.js 14.2.14
- Local: http://localhost:3000
- Network: http://0.0.0.0:3000
✓ Starting...
✓ Ready in 184ms
File upload error: Error: Cannot find module 'proxy-agent'
Require stack:
- /app/node_modules/box-typescript-sdk-gen/lib/internal/utils.js
- /app/node_modules/box-typescript-sdk-gen/lib/networking/network.generated.js
- /app/node_modules/box-typescript-sdk-gen/lib/box/ccgAuth.generated.js
- /app/node_modules/box-typescript-sdk-gen/lib/box/index.js
- /app/node_modules/box-typescript-sdk-gen/lib/index.js
- /app/.next/server/pages/api/upload.js
- /app/node_modules/next/dist/server/future/helpers/module-loader/node-module-loader.js
- /app/node_modules/next/dist/server/future/helpers/module-loader/route-module-loader.js
- /app/node_modules/next/dist/server/next-server.js
- /app/node_modules/next/dist/server/next.js
- /app/server.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
at /app/node_modules/next/dist/server/require-hook.js:55:36
at Module._load (node:internal/modules/cjs/loader:981:27)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at mod.require (/app/node_modules/next/dist/server/require-hook.js:65:28)
at require (node:internal/modules/helpers:177:18)
at createAgent (/app/node_modules/box-typescript-sdk-gen/lib/internal/utils.js:376:39)
at new NetworkSession (/app/node_modules/box-typescript-sdk-gen/lib/networking/network.generated.js:11:49)
at new BoxClient (/app/node_modules/box-typescript-sdk-gen/lib/client.generated.js:78:31)
at u (/app/.next/server/pages/api/upload.js:1:1533) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/app/node_modules/box-typescript-sdk-gen/lib/internal/utils.js',
'/app/node_modules/box-typescript-sdk-gen/lib/networking/network.generated.js',
'/app/node_modules/box-typescript-sdk-gen/lib/box/ccgAuth.generated.js',
'/app/node_modules/box-typescript-sdk-gen/lib/box/index.js',
'/app/node_modules/box-typescript-sdk-gen/lib/index.js',
'/app/.next/server/pages/api/upload.js',
'/app/node_modules/next/dist/server/future/helpers/module-loader/node-module-loader.js',
'/app/node_modules/next/dist/server/future/helpers/module-loader/route-module-loader.js',
'/app/node_modules/next/dist/server/next-server.js',
'/app/node_modules/next/dist/server/next.js',
'/app/server.js'
]
}
Versions Used
Typescript SDK: 1.6.0
Platform: Node 18, Next 14.2.14 (Pages router, using /api)
congminh1254 commented
Please take a look at this solution and let us know if it's working for you: #213 (comment)
Bests,
Minh