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
{{ message }}
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
Invalid key length on CALENDSO_ENCRYPTION KEY #333
Hello everyone, I have a deployment of cal.com with the following characteristics:
AWS EC2 instance with 2VCPU and 2GB RAM, Ubuntu 22.04 LTS.
Docker Compose deployment.
Everything works fine, but when trying to activate 2FA, it tells me that something went wrong. Checking the Docker Compose logs, I have this message in the console:
RangeError: Invalid key length calcom-1 | @calcom/web:start: at Cipheriv.createCipherBase (node:internal/crypto/cipher:122:19) calcom-1 | @calcom/web:start: at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:141:3) calcom-1 | @calcom/web:start: at new Cipheriv (node:internal/crypto/cipher:249:3) calcom-1 | @calcom/web:start: at Object.createCipheriv (node:crypto:141:10) calcom-1 | @calcom/web:start: at symmetricEncrypt (/calcom/apps/web/.next/server/chunks/69559.js:1:278) calcom-1 | @calcom/web:start: at handler (/calcom/apps/web/.next/server/pages/api/auth/two-factor/totp/setup.js:1:3027) { calcom-1 | @calcom/web:start: code: 'ERR_CRYPTO_INVALID_KEYLEN' calcom-1 | @calcom/web:start: } calcom-1 | @calcom/web:start: RangeError: Invalid key length calcom-1 | @calcom/web:start: at Cipheriv.createCipherBase (node:internal/crypto/cipher:122:19) calcom-1 | @calcom/web:start: at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:141:3) calcom-1 | @calcom/web:start: at new Cipheriv (node:internal/crypto/cipher:249:3) calcom-1 | @calcom/web:start: at Object.createCipheriv (node:crypto:141:10) calcom-1 | @calcom/web:start: at symmetricEncrypt (/calcom/apps/web/.next/server/chunks/69559.js:1:278) calcom-1 | @calcom/web:start: at handler (/calcom/apps/web/.next/server/pages/api/auth/two-factor/totp/setup.js:1:3027) { calcom-1 | @calcom/web:start: code: 'ERR_CRYPTO_INVALID_KEYLEN' calcom-1 | @calcom/web:start: }
From what I understand, there is an issue with the length of the secret used to encrypt the information. Can someone help me with the necessary specifications to get this accepted?
I'm already using openssl rand -base64 32 to generate a random string, but I still can't get it to work.
Activity
johan-cruxdata commentedon Mar 14, 2024
have you tried the old guidance of
openssl rand -base64 24?tiagocdr commentedon Nov 30, 2024
Having the exact same problem
ozzyoss77 commentedon Dec 19, 2024
Yes, that it works, Thanks
Stefan2706 commentedon May 13, 2025
Hi,
ich habe das gleiche Thema. Was muss ich genau machen? Kann mir jemand helfen?
Vielen Dank
Viele Grüße
Stefan
Novapixel1010 commentedon Jul 11, 2025
I know this is old but doing this for v5.4.17 fixed 2FA
Fix secrets setup to resolve 2FA and encryption key issues