Skip to content

Invalid initialization vector when set Api Key on user #13063

@ziermach

Description

@ziermach

Describe the Bug

Since last Update we getting the Error "Invalid initialization vector"
API Key in Database is plain before it was in another Format.

Stacktraces:

ERROR: Invalid initialization vector
err: {
"type": "TypeError",
"message": "Invalid initialization vector",
"stack":
TypeError: Invalid initialization vector
at Decipheriv.createCipherBase (node:internal/crypto/cipher:121:19)
at Decipheriv.createCipherWithIV (node:internal/crypto/cipher:133:3)
at new Decipheriv (node:internal/crypto/cipher:278:3)
at Object.createDecipheriv (node:crypto:147:10)
at tq.eL [as decrypt] (/home/node/.next/server/chunks/920.js:287:32350)
at el.hooks.afterRead (/home/node/.next/server/chunks/920.js:292:421385)
at I (/home/node/.next/server/chunks/920.js:331:138975)
at /home/node/.next/server/chunks/920.js:331:146507
at Array.forEach ()
at w (/home/node/.next/server/chunks/920.js:331:146484)
"code": "ERR_CRYPTO_INVALID_IV"
}

Link to the code that reproduces this issue

not public

Reproduction Steps

Set new API key on user and Save

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 22.16.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.45.0
  next: 15.3.5
  @payloadcms/db-mongodb: 3.45.0
  @payloadcms/email-nodemailer: 3.45.0
  @payloadcms/graphql: 3.45.0
  @payloadcms/next/utilities: 3.45.0
  @payloadcms/payload-cloud: 3.45.0
  @payloadcms/plugin-cloud-storage: 3.45.0
  @payloadcms/plugin-form-builder: 3.45.0
  @payloadcms/plugin-search: 3.45.0
  @payloadcms/richtext-lexical: 3.45.0
  @payloadcms/richtext-slate: 3.45.0
  @payloadcms/storage-s3: 3.45.0
  @payloadcms/translations: 3.45.0
  @payloadcms/ui/shared: 3.45.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions