Version 1.2: Update on runtime support #515
pilcrowonpaper
announced in
Announcements
Replies: 1 comment 7 replies
-
Have you considered using cuid2 instead of web crypto? I think it wouldn't have this problem. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Make sure to use 1.2.1 - there was a broken import statement in 1.2.0
Hello! This is an important update as Lucia now documents runtime support:
Node 19?! Yeah... Lucia doesn't rely on any dependencies (including native Node.js modules), which is great, but it requires the
Crypto
web API. And... the one runtime version that doesn't expose it as a global object is Node.js 18 and lower. (Why do you have to do this to me)So with this update, you'll now have to polyfill and expose
Crypto
(specificallywebcrypto
from Nodecrypto
module - yes it's kinda confusing) as a global variable. This is already handled in SvelteKit and does not require any action on your front. For those not using those frameworks (including Astro and Next.js), you have 3 options:[email protected]
)1. Use the polyfill provided by Lucia
Import
lucia-auth/polyfill/node
before initializing Lucia:This is only available for Node.js v16 or later.
2. Use
--experimental-global-webcrypto
flagThis is only available for Node.js v16 or later.
3. Use a third party polyfill
Beta Was this translation helpful? Give feedback.
All reactions