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

Redis subscribe function takes two args only #64

Open
q8tywolf opened this issue Jun 29, 2024 · 1 comment
Open

Redis subscribe function takes two args only #64

q8tywolf opened this issue Jun 29, 2024 · 1 comment

Comments

@q8tywolf
Copy link

Package version

9.1

Describe the bug

I get the following error in my code while am following the documentation.

With IORedis

redis.on('message', (channel, messages) => {
  console.log(message)
})

redis.subscribe('user:add', (error, count) => {
  if (error) {
    console.log(error)
  }
})

With AdonisJS

redis.subscribe('user:add', (message) => {
  console.log(message)
},
{
  onError(error) {
    console.log(error)
  },
  onSubscription(count) {
    console.log(count)
  },
})

Expected 2 arguments, but got 3.ts(2554)

        redis.subscribe(`job-application:${entityId}`, (message) => {
            console.log('send message:', message)
        }, {
            onError(error) {
                console.error('Failed to subscribe:', error)
            },
            onSubscription(count) {
                console.log(`Subscribed to ${count} channels.`)
            },
        })

Reproduction repo

No response

@thetutlage
Copy link
Member

  • Where does this error come from?
  • Can you please share the complete error stack?

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

No branches or pull requests

2 participants