You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per discussion in the discord channel, we are looking at how to help making remix-auth works with the Cloudflare Workers runtime. Currently there are a few blockers we noticed:
Usage @remix-run/server-runtime as peerDependencies instead of @remix-run/node
While (1) is critical to be fixed, possibly by replacing it with @remix-run/server-runtime. People can get around issues (2) and (3) by polyfilling crypto themselves:
For example, with esbuild, we can use esbuild-plugin-alias to polyfill the crypto package:
functiondec2hex(dec){returndec.toString(16).padStart(2,"0");}functionrandomBytes(len){vararr=newUint8Array((len||40)/2);crypto.getRandomValues(arr);returnArray.from(arr,dec2hex).join("");}module.exports={// you can either leave it as an empty object or provides a polyfill for some methods from crypto
randomBytes,};
Now that the Remix Auth package doesn't come with strategies the package itself supports CF Workers just fine and it's up to the strategies to support CF Workers or not.
The new remix-auth-email-link strategy based on the KCDStrategy has support for CF Workers.
The BasicStrategy is not published as an individual package.
As per discussion in the discord channel, we are looking at how to help making
remix-auth
works with the Cloudflare Workers runtime. Currently there are a few blockers we noticed:@remix-run/server-runtime
as peerDependencies instead of@remix-run/node
crypto.randomBytes
on OAuth2Strategy #57crypto
on KCDStrategy #58Buffer
on BasicStrategy #59Can we get around it?
While (1) is critical to be fixed, possibly by replacing it with
@remix-run/server-runtime
. People can get around issues (2) and (3) by polyfillingcrypto
themselves:For example, with
esbuild
, we can useesbuild-plugin-alias
to polyfill thecrypto
package:With this setup, depends on the polyfill setup, you should be able to use strategies not relying on
crypto
.The text was updated successfully, but these errors were encountered: