Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Client event routing issue #945

Open
Yug-Damon opened this issue Sep 28, 2023 · 4 comments
Open

Client event routing issue #945

Yug-Damon opened this issue Sep 28, 2023 · 4 comments

Comments

@Yug-Damon
Copy link

Yug-Damon commented Sep 28, 2023

EDIT:
My environment
osixia/openldap + ldapjs:3.0.5
the error is happening on a LDAP SEARCH query


File ./lib/client/client.js Line 1260

let event = msg.constructor.name
// Generate the event name for the event emitter, i.e. "searchEntry"
// and "searchReference".
event = (event[0].toLowerCase() + event.slice(1)).replaceAll('Result', '')
return sendResult(event, msg)

For some reason event[0] is undefined and therefore my app crashes on the toLowerCase call

I suggest to replace the if block with:

if(msg instanceof SearchEntry) {
      return sendResult('searchEntry', msg)
} else if(msg instanceof SearchReference) {
      return sendResult('searchReference', msg)
} else {
    ...
}

I think it's a terrible idea to base decision on constructor.name value.
I've struggled 2.5 days to figure it out.

@jsumners
Copy link
Member

Please provide a minimal reproducible example. Doing so will help us diagnose your issue. It should be the bare minimum code needed to trigger the issue, and easily runnable without any changes or extra code.

You may use a GitHub repository to host the code if it is too much to fit in a code block (or two).

@melissakintz
Copy link

Hello, same error for me and here

@Yug-Damon
Copy link
Author

@melissakintz yes that's actually a post of mine, I'm gonna mark it as resolved and link the post to this ticket

@DukeVenator
Copy link

We had the same problem and applied the patch mentioned above using a nifty NPM module called patch-package to persist it across our development team.

if(msg instanceof SearchEntry) { return sendResult('searchEntry', msg) } else if(msg instanceof SearchReference) { return sendResult('searchReference', msg)

This package unmodified works on Node18 on Windows but when we deploy to our node image running on ocp 3.11 on a container the issue the OP occurs.

By applying the fix our NextAuth works flawlessly. I suggest perhaps taking a closer look at this issue.

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

No branches or pull requests

4 participants