Could not resolve "fs", "http", "https", "url", ....

Hey, I'm using Hono in the backend, from where I'm uploading an image to Cloudinary. As I installed the Cloudinary package, it has some dependencies of its own, such as 'fs', 'https', 'http', 'url', etc. Unfortunately, Cloudflare Workers do not support these Node.js packages. I tried adding node_compat in my wrangler.toml file, but it didn't fix anything. I can't add "node:" to each of those packages, as they are all Cloudinary dependencies. The same is the case with the 'bcrypt' package. I've certainly lost 20% of my brain cells working on it. Any help is appreciated!
No description
3 Replies
Hard@Work
Hard@Work7mo ago
I believe some of those just aren't supported, so you would either need to patch the package manually to not use them, or build your own system to interact with Cloudinary manually
i_mkait
i_mkaitOP7mo ago
I didn't get it. Patching package manually like, install each of these package separately??
Hard@Work
Hard@Work7mo ago
Yeah. Going through each dependency that uses Node-specific modules, then patching them to use the APIs available in Workers + the Node modules that are supported on Workers via nodejs_compat Or rolling your own SDK for connection to Cloudinary that bypasses the need for those APIs/packages entirely
Want results from more Discord servers?
Add your server