replicate-javascript: Reading from "node:crypto" is not handled by plugins
Environment:
Node Version: 20.11.1 macOS: 14.2.1 next: 14.1.3 replicate: 0.28.1
I am getting Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme). while building my project.
pnpm build command is causing the issue but pnpm dev (developer mode) works fine.
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Reactions: 2
- Comments: 15 (2 by maintainers)
Hey everyone. We just released v0.29.3, which includes changes from #250 that should resolve things. Please let us know if they don’t. Thanks for your patience and help finding a solution 🙇
I just removed the
require('node:crypto')code (PR: https://github.com/replicate/replicate-javascript/pull/243) and built a custom package, and pasted it into my codespace, and it seems to workHere you can see how I made it: https://github.com/run-llama/LlamaIndexTS/pull/731/files#diff-0a946a42f586de9c04be9cfe31eec6a8ff9d14721b79565958dd13458ab9260e
Sorry, I mistyped the Replicate version…
Replicate v0.26.0 currently runs and builds fine for me so am I am using that for now.
Replicate v0.27.0+ will not build and shows the
UnhandledSchemeError: Reading from "node:crypto" ...error.Looks good locally as well as deployed on Vercel using Node 18.x - thanks a ton!
Node 18.18.2 locally - Replicate 0.29.1 + webpack externals config = ok
Node 18.x on Vercel (vercel screen grab below) - Replicate 0.29.1 + webpack externals config = error on build
Using Next 14.4.2 and PNPM here. Solved here by editing the
next.config.jsand tweaking the webpack config:Edited to correct Replicate package version
FWIW ~ I’m seeing the same error.
I am using Turborepo for a few web apps, all Next.js projects.
I am using this Replicate client + the Vercel AI SDK.
It was working OK until
v0.2.7v0.27.0 when I started seeing the ‘node:crypto’ plugin error when trying to build my project. (same for all subsequent versions of replicate)I tried some workarounds but haven’t solved it yet…
(also, I’m using Yarn for dependency management but doubt that makes a difference)