nextjs - ✅(Solved) Fix Crypto polyfill [1 pull requests, 4 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85237Fetched 2026-04-08 02:16:59
View on GitHub
Comments
4
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
commented ×4subscribed ×2issue_type_added ×1labeled ×1

Error Message

  1. Observe; console does not log the randomUUID (throws an error) and so does client-side

PR fix notes

PR #66: turbo sdk upload

Description (problem / solution / changelog)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

  • New Features

    • Migrated Arweave uploads from proxy-based flow to direct Turbo SDK implementation for improved efficiency
    • Added real-time progress tracking capability for file uploads
    • Introduced uploadJson utility helper for uploading JSON metadata
  • Documentation

    • Updated integration examples with Next.js 16 configuration requirements
    • Added setup instructions for required browser polyfills
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Changed files

  • api-reference/arweave/upload.mdx (modified, +88/-63)
  • arweave/upload-to-arweave.mdx (modified, +156/-97)

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.1.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/quizzical-maxwell-cdww8j

To Reproduce

  1. pnpm install
  2. pnpm dev (webpack)
  3. Visit localhost:3000
  4. Observe; console logs the randomUUID (when a client component is first ran on the server), but fails client-side
  5. Add the node: protocol to crypto
  6. Observe; console does not log the randomUUID (throws an error) and so does client-side

Current vs. Expected behavior

For client components, it seems that crypto is only pollyfilled server-side (where client components are first render on) and only with the non-protocol import.

importServer-sideClient-side
crypto
node:crypto

Shouldn't crypto be pollyfilled consistently? So node:crypto (with protocol) is also polyfilled server-side and preferably also client-side for both.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Webpack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

extent analysis

TL;DR

The issue can be resolved by consistently polyfilling the crypto module for both server-side and client-side rendering, including when using the node:crypto protocol.

Guidance

  • Verify that the crypto module is properly polyfilled in the Next.js configuration for both server-side and client-side rendering.
  • Check the Webpack configuration to ensure that the crypto module is not being excluded or overridden for client-side rendering.
  • Test using the crypto module without the node: protocol to see if the issue persists, and consider using a consistent import method throughout the application.
  • Review the Next.js documentation and Webpack configuration to ensure that the crypto module is properly handled for both server-side and client-side rendering.

Example

No explicit code example is provided as the issue is related to configuration and polyfilling, but ensuring consistent import and configuration of the crypto module is crucial.

Notes

The issue seems to be specific to the Next.js and Webpack configuration, and resolving it may require adjustments to the project's setup and dependencies.

Recommendation

Apply a workaround by consistently polyfilling the crypto module for both server-side and client-side rendering, as this seems to be the most straightforward way to resolve the issue without upgrading or changing the underlying dependencies.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING