Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument of type '(nsp: any) => RedisStreamsAdapter' is not assignable to parameter of type 'AdapterConstructor' socket.io version 4.7.5 #5014

Closed
ayyan-deserve opened this issue Apr 27, 2024 · 2 comments

Comments

@ayyan-deserve
Copy link

The bug
I am trying to integrate the Redis Streams adapter@0.2.1 with ioredis@5.4.1 and socket.io@4.7.5

// Typescript
import http from "http";
import { Server } from "socket.io";
import { Redis } from "ioredis";
import { createAdapter } from "@socket.io/redis-streams-adapter";

const io = new Server<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>(httpServer, {
/* configuration options */
})
io.adapter(createAdapter(new Redis()));

And I'm getting an error with io.adapter(createAdapter(new Redis()))

Argument of type '(nsp: any) => RedisStreamsAdapter' is not assignable to parameter of type 'AdapterConstructor'.
  Type '(nsp: any) => RedisStreamsAdapter' is not assignable to type '(nsp: Namespace<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>) => Adapter'.
    Type 'RedisStreamsAdapter' is missing the following properties from type 'Adapter': nsp, rooms, sids, encoder, and 34 more.ts(2345)

Platform:

  • OS: MacOS
  • Nodejs: 20.11.0
@ayyan-deserve ayyan-deserve added the to triage Waiting to be triaged by a member of the team label Apr 27, 2024
@darrachequesne
Copy link
Member

Hi! Could you please check your version of socket.io-adapter with npm ls socket.io-adapter? It is imported by both socket.io and @socket.io/redis-streams-adapter packages, and the versions should match.

@darrachequesne darrachequesne added needs investigation and removed to triage Waiting to be triaged by a member of the team labels Apr 30, 2024
@ayyan-deserve
Copy link
Author

Hi @darrachequesne Thanks for the help...
Forcing the socket.io-adapter to 2.5.4 seems to fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants