#Astro SSR runtime crypto API not all available

1 messages · Page 1 of 1 (latest)

fickle terrace
#

I am trying to adapt Auth.js to Astro but I found that not all the crypyo APIs are available during SSR. It seems that only getRandomValue is defined, crypto.subtle is undefined. This caused that Auth.js is not able to generate tokens.

#

I guess the environment of Astro SSR is probably unsafe so that the crypto apis are not avoided.

#

I also already modified the code in Auth.js' codebase which uses crypto.subtle (I am importing the crypto node module) but there are still some external libraries using crypto.subtle and it's fairly impossible to modify all of them.

#

The globalThis.crypto is also readonly so that I am unable to polyfill the crypto apis.

#

I made some small tests and it seems that it's the problem of Vite.

#

Anyone familiar with that?

full hawk
#
fickle terrace
#

Thank you! This repo is so hard to find... (Actually I already solved my problem😂 )