Closed saurabhjdsingh closed 7 months ago
Hey @saurabhjdsingh ! I had the same issue, you need to install those packages first.
I did it with Yarn,
npm install stream-http --save-dev
npm install https-browserify --save-dev
npm install os-browserify --save-dev
Then you can add those to your webpack config file, like so:
resolve: { fallback: { http: require.resolve("stream-http"), https: require.resolve("https-browserify"), os: require.resolve("os-browserify/browser"), } }
For me that fixed my issue. Hope this helps!
@mariusgnicula @saurabhjdsingh Would like to know your use case more. Are you looking at using this package in browser ?
I would imagine these errors would pop up when using a Next.js Edge Runtime to host with edge functions on Vercel (way more performant than Node.js; there are virtually no cold start times). However, only certain Web APIs are supported instead of the full set of Node.js APIs...
Same issue here and as @jalexw surmised, I'm encountering the same error when trying to use Chargebee TS lib on Vercel edge functions. Fails on these lines in Core.js as these modules are not supported in Vercel edge.
Core.http = require('http');
Core.https = require('https');
Core.os = require('os');
Hello folks, this SDK is currently not supported in Edge runtimes. This is also not supported in browsers. Like mentioned in https://github.com/chargebee/chargebee-typescript/issues/50#issuecomment-2020376820, we're planning to make this Edge runtime compatible but we don't have any timelines yet.
I'm closing this issue for now and request you all to keep track of the Edge runtime compatibility in #50. Thanks.
Just FYI, we have a fully Edge compatible Fork of the chargebee api client: https://github.com/Hive-IT-GmbH/chargebee-node We use it on Vercel and Cloudflare Pages.
Please note: We do not offer any kind of support. The fork is ment "as it is" and might push Chargebee to officially move on as the changes are minimal when using a modern NodeJS runtime ;-)
Thanks for the note @JanThiel. Good to see this :)
And yeah, we're starting with this soon ;-)
Hi @bdueck-oftr @jalexw @mariusgnicula, we have repleased a new beta version that supports different run times like Workers, Deno, Bun etc. It'd be great if you could give it a try and share your feedback.
You can install this using npm install chargebee@beta
Edit: We have a Migration guide for v3. README in the next
branch also has more info on the usage.
I have installed chargebee-typescript in my angular 14 app using
npm install chargebee-typescript@">=2"
Then imported the library as:
import {ChargeBee} from 'chargebee-typescript'; var chargebee = new ChargeBee();
Now I see this error =>