Skip to content

Getting "Error: crypto.createCipher is not a function" when running with Node.js v22 #192

@juissi-t

Description

@juissi-t

I'm getting this error when trying to generate a token with Node.js v22:

/home/juissi/gh-public/external-auth-server/src/utils.js:86
    throw new Error(exception.message);
    ^

Error: crypto.createCipher is not a function
    at Object.encrypt (/home/juissi/gh-public/external-auth-server/src/utils.js:86:11)
    at Object.<anonymous> (/home/juissi/gh-public/external-auth-server/bin/generate-config-token-stdin.js:32:38)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5)
    at node:internal/main/run_main_module:30:49

Node.js v22.8.0

It looks like crypto.createCipher was removed in Node v22. It's still present in Node v21 and earlier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions