Open
Description
Possibly a Next.js specific issue.
I'm using Next.js
with ldap-authentication
. There is no issue when running Next.js in development mode, but as soon as we do a production build, we encounter an issue retrieving user details after authentication.
The authentication process works, but fetching the details fails. There is no code change between the development and production build.
We receive the following error.
Error:
d: user logged in, but user details could not be found. Probabaly usernameAttribute or userSearchBase is wrong?
Authentication Error: d: user logged in, but user details could not be found. Probabaly usernameAttribute or userSearchBase is wrong?
nextjs-1 | at f (/usr/src/app/.next/server/chunks/2227.js:1:113941)
nextjs-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
nextjs-1 | at async p (/usr/src/app/.next/server/chunks/2227.js:1:115642)
nextjs-1 | at async j (/usr/src/app/.next/server/app/api/me/route.js:1:3469)
nextjs-1 | at async /usr/src/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:34666
nextjs-1 | at async eS.execute (/usr/src/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:25813)
nextjs-1 | at async eS.handle (/usr/src/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:35920)
nextjs-1 | at async doRender (/usr/src/app/node_modules/next/dist/server/base-server.js:1377:42)
nextjs-1 | at async cacheEntry.responseCache.get.routeKind (/usr/src/app/node_modules/next/dist/server/base-server.js:1599:28)
nextjs-1 | at async NextNodeServer.renderToResponseWithComponentsImpl (/usr/src/app/node_modules/next/dist/server/base-server.js:1507:28)
Example Code:
export const LDAP_CONFIG = {
url: "ldap://ldap.company.com",
baseDN: "cn=users,dc=company,dc=com",
};
// Authenticate user against LDAP
let authenticated = await authenticate({
ldapOpts: { url: LDAP_CONFIG.url },
userDn: `uid=${username},${LDAP_CONFIG.baseDN}`,
userPassword: password,
userSearchBase: LDAP_CONFIG.baseDN,
usernameAttribute: "uid",
username: `${username}`,
attributes: ["uid", "cn", "givenName", "mail"],
});
We are using the latest version, but I have reverted back to 3.0.3 and am still encountering the same issue.
ldap-authentication@npm:3.2.2
├─ Version: 3.2.2
└─ Dependencies
└─ ldapjs@npm:^3.0.7 → npm:3.0.7
Metadata
Metadata
Assignees
Labels
No labels