Skip to content

SessionStore & RedisStore typescript error #647

@pcastro-handover

Description

@pcastro-handover

Checklist

Description

Getting the following error when trying to assign ConfigParams.session.store:

Type 'RedisStore' is not assignable to type 'SessionStore<Session>'.

Reproduction

Just try to assign the RedisStore to store:

const authConfig: ConfigParams = {
  (...)
  session: {
    (...)
    store: new RedisStore({
      client: new Redis({...})
  }
}

Additional context

Whole message error:

Type 'RedisStore' is not assignable to type 'SessionStore<Session>'.
  Types of property 'set' are incompatible.
    Type '(sid: string, sess: SessionData, cb?: ((_err?: unknown, _data?: any) => void) | undefined) => Promise<void>' is not assignable to type '(sid: string, session: SessionStorePayload<Session>, callback?: ((err?: any) => void) | undefined) => void'.
      Types of parameters 'sess' and 'session' are incompatible.
        Type 'SessionStorePayload<Session>' is not assignable to type 'SessionData'.
          Types of property 'cookie' are incompatible.
            Property 'originalMaxAge' is missing in type '{ expires: number; maxAge: number; }' but required in type 'Cookie'.ts(2322)

index.d.ts(325, 9): 'originalMaxAge' is declared here.

express-openid-connect version

2.18.0

Express version

4.21.2

Node.js version

20.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions