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

Proxy-man not found in production build #370

Closed
4 tasks done
trevordebard opened this issue Oct 3, 2024 · 1 comment
Closed
4 tasks done

Proxy-man not found in production build #370

trevordebard opened this issue Oct 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@trevordebard
Copy link

  • 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
Copy link
Member

Hi @trevordebard

Please take a look at this solution and let us know if it's working for you: #213 (comment)

Bests,
Minh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants