#Production build breaks EventEmitter

7 messages · Page 1 of 1 (latest)

mellow plinth
#

I'm using ldapjs inside of NextJS 14 and a production build breaks the client.search() function which is a nodejs EventEmitter implementation. The search function fires off and then listens for events; in development mode the "searchEntry" event fires as expected when the ldap server returns results, but in production mode it does not.

I have confirmed using Wireshark that in both the dev server as well as production server the ldap search is returning results as expected; however, something is keeping the production server from noticing/processing the results; it just hangs there until the timeout function fires.

Here is my code:
https://gist.github.com/Tesin/a9aeb11710c54c008622583087b89c19

I am authenticating against the ldap server using a Service Account which will then let me execute a search for the user and retrieve the full DN.

Here is the reference documentation for client.search():
https://ldapjs.org/client.html#search

I've suspected this to be a caching issue but i've tried everything I know to disable caching using route segment config all over this project.

Halp, please 😦

Gist

LDAPjs in NextJS 14. GitHub Gist: instantly share code, notes, and snippets.

stone coralBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

storm bane
#

are you running production version on vercel? it can have runtime limitations

mellow plinth
#

In my VSCode terminal (or any terminal on my laptop), just switching from "npm run dev" to "npm run build" and "npm start" triggers this.

#

Vercel is not in play.

storm bane
mellow plinth
#

That bug is why I have a setTimeout in the end event to delay its execution. I can completely remove the end event and the behavior is the same unfortunately.