fix(self-hosted): profile update returns 500 with dashboard Basic auth
Summary
On self-hosted Nango deployments using dashboard HTTP Basic auth, updating the Profile Settings display name persists the database change but returns 500. The dashboard consequently shows a failure toast even though the name changed.
Environment
- Self-hosted Nango
0.71.4 FLAG_AUTH_ENABLED=falseNANGO_DASHBOARD_USERNAMEandNANGO_DASHBOARD_PASSWORDconfigured
In this configuration, routes.private.ts authenticates dashboard requests with Passport Basic auth using { session: false }.
Steps to reproduce
- Start a self-hosted deployment with the Basic-auth configuration above.
- Sign in to the dashboard and open Profile settings.
- Edit and save the display name.
- Observe a generic server-error toast.
- Reload the page or inspect
_nango_users; the new name was persisted.
Expected behavior
PATCH /api/v1/user returns 200 with the updated user, and the dashboard shows success.
Actual behavior
userService.update commits successfully, then the controller throws while evaluating:
req.session.passport.user = updated;Basic authentication deliberately has no persistent Passport session, so req.session.passport is undefined. The resulting synchronous error is wrapped as a generic 500 after the durable update has already happened.
Root cause and proposed fix
The session rewrite is obsolete for both authentication modes:
- Basic auth resolves the user from PostgreSQL on every request.
- Session auth serializes the user ID, and
fillLocalsFromSessionreloads the current database user withuserService.getUserById(req.user.id)on every request.
The minimal fix is to remove the direct Passport-session mutation and return userToAPI(updated) after the database update.
Tested patch: https://github.com/LevSky22/nango/commit/4cdb0afb4348780d5970d9748fac1f3c87f40740
The patch adds:
- A unit regression test proving profile updates succeed without
session.passport. - An integration test proving a real session stays authenticated and observes the updated name on a subsequent GET.
Validation completed:
- Focused unit test
- Focused integration test with Testcontainers
npm run ts-build- Prettier and type-aware oxlint on the changed files
Following the repository contribution policy, I have not opened a pull request. I am happy to open one if maintainers would like this patch submitted directly.
Source: NangoHQ/nango