-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] NextJS Edge Runtime Support #50
Comments
Hey @JanThiel, Thanks a lot for the detailed notes. Yes, we're considering making the SDK Edge compatible but we don't have a solid timeline for this yet unfortunately. I will share updates here when we have more details & timeline for this. |
Thanks for your feedback. From our current knowledge the We will use a fork of the library till you have some official release. Best, Jan |
It would have been to easy ;-)
|
Got that sorted out as well. tldr: You have to raise the Min NodeJS Version of the package to 18. Then you can use But to have the native web libraries in NodeJS version 18 is required. You can find the changes - based on |
Just as a note: The fork is running fine on Vercel and Cloudflare Pages. |
Hi @JanThiel, we have released a new beta version that supports Edge Runtime and will eventually be the single package to integrate Chargebee using JavaScript/TypeScript. It'd be great if you could try it and share your feedback. You can install this using |
@cb-sriramthiagarajan Thank you very much for the update and your work. Looks like a massive improvement to me. |
That's great @JanThiel! Thanks for checking this quickly. How much is your fork diverged from upstream? I wonder how easy / difficult would it be to switch from your fork to this package once we're out of |
@cb-sriramthiagarajan I would say it's a straightforward task. Nothing complex nor surprising. The code gets cleaner. So there is a real benefit in migrating to 3.0. But still you have to change all library calls. The most remarkable changes we encountered while migrating: New Import - import chargebee from "chargebee";
+ import Chargebee from "chargebee"; Setup as Object instantiation - chargebee.configure({
- site: process.env.CHARGEBEE_SITE,
- api_key: process.env.CHARGEBEE_API_KEY
- });
+ const chargebee = new Chargebee({
+ site: process.env.CHARGEBEE_SITE,
+ apiKey: process.env.CHARGEBEE_API_KEY
+ }); Removal of the need to call - const subscription = await chargebee.subscription.retrieve(params.id).request();
+ const subscription = await chargebee.subscription.retrieve(params.id); Typings are now much better and autocomplete as well. Naturally. |
Close to none, Just patched the base library. Nothing changed that has any impact on the usage of the library. As such I simply merged your upstream changes into it with no issues. |
Awesome, you captured the major changes accurately @JanThiel 😄 I forgot to mention that we have a Migration guide for v3 and the README in the
That's great to hear! We'll be testing this with a few customers to see if there are any issues before we publish this as the |
we do face some issue on the local development. Although it runs fine on Cloudflare Pages, it does not locally. Neither on Windows nor on Mac. We use NextJS 14.2.7 on NodeJS 20.15.1. pnpm 8.7.1 as package manager. Using the following call with the 3.0.0-beta1 triggers the error. Removing the call renders the app just fine. Switching back to the old forked version works fine as well.
This is the shortened Stacktrace with the error (
And here the full error and stacktrace:
This is the
And this is the
|
@cb-sriramthiagarajan This might be related: vercel/next.js#53882 |
Thanks for reporting this @JanThiel. We'll look into this and get back. |
Hi @JanThiel, we've released v3.0.0-beta.2 which fixes this issue. Can you give it a try please? |
Hi @JanThiel, we've released the new major version chargebee v3 which supports Edge runtime. Thanks for testing the beta version earlier. We can close this issue if this is working fine for you. |
Thank you @cb-sriramthiagarajan we already used the latest beta without any further issues! |
Hey there,
in the modern times the "Edge" runtime gets more and more attention. It is a subset of the NodeJS API which makes it faster and more suitable for "Cloud Hosting" services like Vercel or Cloudflare Pages. In particular when building NextJS apps.
As hosting a custom Chargebee Portal / Checkout on one of the aforementioned services in combination with a NextJS app is quite a powerful approach, I would like to ask whether you are willing to make this library "Edge" compatible. There should only be some places where you have to switch packages or only use them conditionally.
There is this nice guide which explains the benefits of offering Edge support:
https://vercel.com/guides/library-sdk-compatible-with-vercel-edge-runtime-and-functions
And some more compare-charts-docs explaining the Edge runtime compared to full NodeJS:
https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
And finally the Edge Runtime - as in "all the supported APIs" - for NextJS is documented here:
https://nextjs.org/docs/app/api-reference/edge
Based on our current development the one problematic place is this:
chargebee-typescript/src/core.ts
Line 8 in 2bc591b
And it is just used for information Metadata... So not really necessary at all.
Thank you for reading and considering :-)
The text was updated successfully, but these errors were encountered: