Closed Maronato closed 1 year ago
Let's see what CI has to say about this, we'll find out quick if this is works. 🤞
CI failure:
error: Uncaught "The following specifiers were indicated to be mapped to a package, but were not found:\n * https://deno.land/x/cbor@v1.5.2/index.js"
You also need to update the path mapping this to an NPM package here:
https://github.com/MasterKale/SimpleWebAuthn/blob/master/packages/server/build_npm.ts#L73
But since we're not importing index.js I don't know hot dnt will handle this 🤔
All tests passed with act
Hi @MasterKale! CI should pass now. Let me know if you need anything else :)
Thank you for your contribution, @Maronato, this looks good to me :shipit:
@Maronato This fix is now available in @simplewebauthn/server@8.3.2
One of @simplewebauthn/server dependencies cbor-x, supports streams, which uses Node's and Deno's
stream
interface.Unfortunately,
stream
is not part of the standard Web APIs that many edge compute runtimes use (e.g. Vercel doesn't support it, and Cloudflare requires a separatenode:
namespace). Importing it throws errors like these:Since the only object used from cbor-x is
Encoder
, the fix is pretty simple. Instead of importing the entire package, we only import its encode file, which is officially exported. This avoids loading thestream.js
file that usesstream
.I tested it by patching @simplewebauthn/server directly in my node_modules and it worked without issues, but I haven't attempted to build it locally. I don't see a reason for it not building, though.