Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Invalid key length on CALENDSO_ENCRYPTION KEY #333

Open

Description

@ozzyoss77

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.

Thanks in advance.

Activity

  1. johan-cruxdata commented on Mar 14, 2024

    @johan-cruxdata

    have you tried the old guidance of openssl rand -base64 24?

  2. tiagocdr commented on Nov 30, 2024

    @tiagocdr

    Having the exact same problem

  3. ozzyoss77 commented on Dec 19, 2024

    @ozzyoss77
    Author

    have you tried the old guidance of openssl rand -base64 24?

    Yes, that it works, Thanks

  4. Stefan2706 commented on May 13, 2025

    @Stefan2706

    Hi,

    ich habe das gleiche Thema. Was muss ich genau machen? Kann mir jemand helfen?

    Vielen Dank

    Viele Grüße
    Stefan

  5. Novapixel1010 commented on Jul 11, 2025

    @Novapixel1010

    I know this is old but doing this for v5.4.17 fixed 2FA

  6. added
    documentationImprovements or additions to documentation
    and removed
    documentationImprovements or additions to documentation
    on Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions