express-openid-connect icon indicating copy to clipboard operation
express-openid-connect copied to clipboard

Deprecation warning (promisify) when upgrading to Node v21.6.0

Open Will956 opened this issue 1 year ago • 4 comments

Checklist

Description

Hello 👋

We recently upgraded our Node service to v21.6.0 and we start to see some deprecation warning:

[DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.

With --trace-deprecation argument, we can see those warnings come from the lib:

(node:45354) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at RedisStore.get (node:internal/util:416:12)
    at CustomStore.get (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected][email protected]/node_modules/express-openid-connect/lib/appSession.js:203:19)
    at /REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected][email protected]/node_modules/express-openid-connect/lib/appSession.js:325:46
    at /REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/dd-trace/packages/datadog-instrumentations/src/router.js:22:57
    at /REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/dd-trace/packages/datadog-shimmer/src/shimmer.js:26:21
    at Layer.handle [as handle_request] (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:328:13)
    at /REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:346:12)
    at Function.process_params (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/dd-trace/packages/datadog-instrumentations/src/express.js:70:23)
    at next (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:280:10)
    at Function.handle (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:175:3)
    at router (/REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:47:12)
    at /REDACTED/REDACTED/REDACTED/REDACTED/apps/api-server/dist/main.js:587:14

This comes from this code https://github.com/auth0/express-openid-connect/blob/8ade66846a1f041591e267d2296b02df2604f1f4/lib/appSession.js#L190

Reproduction

Tested in the express-opend-id-connect sample app:

const dotenv = require("dotenv");
const express = require("express");
const http = require("http");
const logger = require("morgan");
const path = require("path");
const router = require("./routes/index");
const { auth } = require("express-openid-connect");

// Redis store
const { createClient } = require("redis");
const RedisStore = require("connect-redis").default;
let redisClient = createClient();
redisClient.connect().catch(console.error);

dotenv.load();

const app = express();

app.set("views", path.join(__dirname, "views"));
app.set("view engine", "ejs");

app.use(logger("dev"));
app.use(express.static(path.join(__dirname, "public")));
app.use(express.json());

const config = {
  authRequired: false,
  auth0Logout: true,
  session: {
    store: new RedisStore({ client: redisClient }),
  },
};

(...)
Capture d’écran 2024-01-17 à 21 36 43

Additional context

No response

express-openid-connect version

2.17.1

Express version

4.18.2

Node.js version

21.6.0

Will956 avatar Jan 17 '24 20:01 Will956

Is this package maintained?

chrisvander avatar Jan 08 '25 16:01 chrisvander

Hey @chrisvander and @Will956 , Apologies for the delay in addressing this issue. We’re prioritising it now and will work on getting it fixed as soon as possible. I’ll keep you updated with any progress along the way. Thanks for your patience!

gyaneshgouraw-okta avatar Feb 12 '25 13:02 gyaneshgouraw-okta

Hello @gyaneshgouraw-okta, do you have any updates on this? Thanks!

Will956 avatar Apr 04 '25 07:04 Will956

Hello @gyaneshgouraw-okta any updates on this issue? Thank you very much for your response in advance.

redoper1 avatar Jun 18 '25 09:06 redoper1

Hi, @Will956, what is the 'connect-redis' version you are using?

kushalshit27 avatar Jun 27 '25 12:06 kushalshit27

"connect-redis": "8.1.0", this one

Will956 avatar Jun 27 '25 12:06 Will956

When we encountered this issue, it was "connect-redis": "7.1.0", - maybe that's what you're are looking for

Will956 avatar Jun 27 '25 12:06 Will956

Hi, @Will956

When we encountered this issue, it was "connect-redis": "7.1.0"

Are you still getting the issue with"connect-redis": "8.1.0" or the one you are currently using?

kushalshit27 avatar Jun 27 '25 15:06 kushalshit27

Yes, still happens

Image

Will956 avatar Jun 27 '25 16:06 Will956

Hi, @Will956 The fix for this issue is now available in version v2.19.2.

Thank you for your patience! This issue has been resolved. Feel free to reopen it if you encounter any further problems.

kushalshit27 avatar Jul 22 '25 10:07 kushalshit27

@kushalshit27 After upgrading to the latest version, we’re encountering a TypeError: callback is not a function when reading the current session using [email protected] as the session store:

'TypeError: callback is not a function at MSSQLStore.get (***/node_modules/connect-mssql-v2/dist/src/store.js:196:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async ***/node_modules/express-openid-connect/lib/appSession.js:327:29'

It seems that express-openid-connect is calling store.get() without a callback as second arg, but connect-mssql-v2 requires it.

redoper1 avatar Jul 22 '25 11:07 redoper1

Hi, @redoper1 , We have released a patch version; please use v2.19.2. I would appreciate it if you tested this out, and if the problem persists, we can re-evaluate.

Thanks

kushalshit27 avatar Jul 22 '25 14:07 kushalshit27

Hi, @kushalshit27,

after initial testing it looks good to me. We will try to use it more in the coming days and report any other potential problems.

Thank you very much for quick fix.

redoper1 avatar Jul 22 '25 18:07 redoper1