Skip to content

Next 16 bundling issue #929

@8times4

Description

@8times4

Language Affected

  • Python
  • TypeScript

🐛 Describe the bug

When trying to build with agentkit present server-side (latest version), the build fails with both turbopack and webpack:

Turbo:

 Next.js 16.1.4 (Turbopack)
- Environments: .env

  Creating an optimized production build ...
✓ Compiled successfully in 16.4s
✓ Finished TypeScript in 10.3s    
  Collecting page data using 15 workers  ..bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
  Collecting page data using 15 workers  ...TypeError: Y is not a function
    at ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/sha3.js (.next/server/chunks/[root-of-the-server]__612f8151._.js:22062:7302)
    at <unknown> (.next/server/chunks/[root-of-the-server]__612f8151._.js:22054:5060)
    at ../../node_modules/.pnpm/viem@2.22.12_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/hash/keccak256.js (.next/server/chunks/[root-of-the-server]__612f8151._.js:22062:7571)
    at <unknown> (.next/server/chunks/[root-of-the-server]__612f8151._.js:22054:5060)
    at ../../node_modules/.pnpm/viem@2.22.12_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/address/getAddress.js (.next/server/chunks/[root-of-the-server]__612f8151._.js:22062:10983)
    at <unknown> (.next/server/chunks/[root-of-the-server]__612f8151._.js:22054:5060)
    at ../../node_modules/.pnpm/viem@2.22.12_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/abi/decodeAbiParameters.js (.next/server/chunks/[root-of-the-server]__612f8151._.js:22062:23148)
    at <unknown> (.next/server/chunks/[root-of-the-server]__612f8151._.js:22054:5060)
    at module evaluation (.next/server/chunks/[root-of-the-server]__612f8151._.js:22062:400919)
    at instantiateModule (.next/server/chunks/[turbopack]_runtime.js:740:9)
(node:89703) Warning: `--localstorage-file` was provided without a valid path
(Use `node --trace-warnings ...` to show where the warning was created)

> Build error occurred
Error: Failed to collect page data for /api/[...all]
    at ignore-listed frames {
  type: 'Error'
}
error: script "build" exited with code 1

Webpack:

$ next build --webpack
⚠ Warning: Next.js inferred your workspace root, but it may not be correct.
 To silence this warning, set `outputFileTracingRoot` in your Next.js config, or consider removing one of the lockfiles if it's not needed.
   See https://nextjs.org/docs/app/api-reference/config/next-config-js/output#caveats for more information.
 Detected additional lockfiles: 

▲ Next.js 16.1.4 (webpack)
- Environments: .env

  Creating an optimized production build ...
⚠ Compiled with warnings in 42s

../../node_modules/.bun/@x402+core@2.2.0/node_modules/@x402/core/dist/cjs/http/index.js
Module not found: Can't resolve '@x402/paywall' in '/node_modules/.bun/@x402+core@2.2.0/node_modules/@x402/core/dist/cjs/http'

Import trace for requested module:
../../node_modules/.bun/@x402+core@2.2.0/node_modules/@x402/core/dist/cjs/http/index.js
../../node_modules/.bun/@x402+fetch@2.2.0+d266f978935bf34a/node_modules/@x402/fetch/dist/cjs/index.js
../../node_modules/.bun/@coinbase+agentkit@0.10.4+7cb4cde1586483a3/node_modules/@coinbase/agentkit/dist/action-providers/x402/x402ActionProvider.js
../../node_modules/.bun/@coinbase+agentkit@0.10.4+7cb4cde1586483a3/node_modules/@coinbase/agentkit/dist/action-providers/x402/index.js
../../node_modules/.bun/@coinbase+agentkit@0.10.4+7cb4cde1586483a3/node_modules/@coinbase/agentkit/dist/action-providers/index.js
../../node_modules/.bun/@coinbase+agentkit@0.10.4+7cb4cde1586483a3/node_modules/@coinbase/agentkit/dist/index.js
../../packages/api/src/utils/agentKit.ts
../../packages/api/src/routers/user.ts
../../packages/api/src/routers/index.ts
../../packages/api/src/root.ts
./src/app/api/[...all]/route.ts

✓ Finished TypeScript in 7.1s    
  Collecting page data using 15 workers  ..bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
TypeError: Y is not a function
    at ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/sha3.js (.next/server/app/api/[...all]/route.js:2653:7302)
    at <unknown> (.next/server/app/api/[...all]/route.js:2645:114883)
    at ../../node_modules/.pnpm/viem@2.22.12_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/hash/keccak256.js (.next/server/app/api/[...all]/route.js:2653:7571)
    at <unknown> (.next/server/app/api/[...all]/route.js:2645:114883)
    at ../../node_modules/.pnpm/viem@2.22.12_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/address/getAddress.js (.next/server/app/api/[...all]/route.js:2653:10981)
    at <unknown> (.next/server/app/api/[...all]/route.js:2645:114883)
    at ../../node_modules/.pnpm/viem@2.22.12_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.24.1/node_modules/viem/_esm/utils/abi/decodeAbiParameters.js (.next/server/app/api/[...all]/route.js:2653:23146)
    at <unknown> (.next/server/app/api/[...all]/route.js:2645:114883)
    at 205684 (.next/server/app/api/[...all]/route.js:2653:400917)
    at k (.next/server/webpack-runtime.js:1:159)
(node:45503) Warning: `--localstorage-file` was provided without a valid path
(Use `node --trace-warnings ...` to show where the warning was created)

> Build error occurred
Error: Failed to collect page data for /api/[...all]
    at ignore-listed frames {
  type: 'Error'
}
error: script "build" exited with code 1

Versions

"@coinbase/agentkit": "^0.10.4"

(does not work on local or vercel)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions