shadow-cljs 2026-04-07

Bingen Galartza Iparragirre 2026-04-07T15:00:51.361959Z

I get "The required JS dependency "crypto" is not available, it was required by node_modules/keycloak-js/dist/keycloak.js" error when upgrading from shadow-cljs 2.28.23 to 3.0.0 . I guess the error comes because keycloak-js https://github.com/keycloak/keycloak-js/blob/0541a724af0598c4d805480c7666060e91d11133/lib/keycloak.js#L1622-L1628 the https://developer.mozilla.org/en-US/docs/Web/API/Crypto. We target the browser, so I understand it should be available with no external dependencies required. What am I missing? I have been searching the message history, but didn't find a solution.

which keycloak-js version? it almost certainly does a require("crypto") which is a node-only package. 3.x removed the automatic polyfilling for that, which you can get back manually if needed

my guess a keycloak update would also fix it. the version you linked doesn't have a require and directly uses the web crypto stuff. guessing the old version you have doesn't

Bingen Galartza Iparragirre 2026-04-07T15:24:16.934349Z

I'm using 25.0.6. I can't upgrade that easilly because it has to match the Keycloak server version. Looking for the source code, it seems they changed the repo

you can use the same (but now manual) polyfill method from before

npm install crypto-browserify and in the build config set :js-options {:resolve {"crypto" {:target :npm :require "crypto-browserify"}}}

crypto-browserify being the polyfill package

Bingen Galartza Iparragirre 2026-04-07T15:26:46.946599Z

I see the old version uses the require yes

Bingen Galartza Iparragirre 2026-04-07T15:26:50.900179Z

Ok, great. Thanks a lot !

FWIW I found crypto working when I used directly without a require - with Node.js: (js/crypto.getRandomValues array)