mux-node-sdk icon indicating copy to clipboard operation
mux-node-sdk copied to clipboard

Announcement: Version 8 released to address many pain points

Open dylanjha opened this issue 7 months ago • 1 comments

We heard about all the pain points people were having with this SDK. Since the time this was originally built (back in 2018) the node ecosystem has evolved substantially and admittedly, we fell a little behind.

That has changed now, and we have a new v8 version of this SDK in beta. It's been re-built from the ground up. So bear with me here. The main things we addressed are:

  1. Much better TypeScript support: previously this SDK was built in JS and to satisfy TS users we were maintaining types by hand. This was unsustainable and inevitably led to types being stale. A number of folks opened issues reporting wrong types and we had to keep playing whack-a-mole to patch those. That is no longer the case.
  2. Support for new JS runtimes: We love that people want to use this SDK with Deno, Bun, Cloudflare Workers, Vercel Edge, etc. That's awesome! The problem was our JWT signing relied on node:crypto which is not available on those platforms. We've fix that.

Those are the 2 big things, but v8 also brings some other quality-of-life improvements like:

  • Configurable retries and timeouts
  • Auto-pagination with for await... of
  • Nice way to access raw response vs. the parsed response

How to use v8

  • It's under the name npm package, on the beta channel: npm i @mux/mux-node@beta
  • Still in this github repo, on branch beta-8. See the README for usage and examples
  • See the api.md file for full API reference

Syntax changes

Since everything here was re-built to be better, there are significant syntax changes. Anywhere you were calling this SDK will require changing your code. If you're using TypeScript your editor should give you nice hints when making these changes.

Also, we highly recommend after installing the v8 SDK you run the codemod script:

npx @getgrit/launcher apply mux_v8

This will edit the files in your project in a way that converts your existing code to the new v8 syntax. The codemod script is working well for us, but you should still verify your code changes and make sure it works as expected before deploying the new code to production.

How you can help

  • Please try out the beta and report any issues
  • Particularly around the codemod script, if there's any issues there please let us know so that we can fix it

We plan to keep this in beta for ~2 weeks and then merge and live happily ever after.

Known issues:

  • [x] mux.video.assets.delete is getting HTTP 406 error. Possibly the other delete endpoints are getting this as well. Stay tuned as we get this resolved. (fixed in 8.0.0-canary.4)

dylanjha avatar Jan 12 '24 21:01 dylanjha

Update: Version 8 has been released:

https://github.com/muxinc/mux-node-sdk/releases/tag/v8.0.0

dylanjha avatar Feb 12 '24 20:02 dylanjha