fix(pi): add snap node compatibility diagnostics and documentation

- Added detailed error logging to detect snap node compatibility issues
- When Pi process exits with code 1, log helpful diagnostic info including node path
- Add hint to check for snap node and reinstall via apt/nvm
- Create SNAP_NODE_COMPATIBILITY.md with full troubleshooting guide
- Document root cause: snap node has file descriptor incompatibility with Bun.spawn stdin pipes
- Provide clear installation instructions for NodeSource and nvm alternatives
This commit is contained in:
2026-03-04 01:45:36 +00:00
parent 72d1341cbc
commit ef13f96d36
34 changed files with 2394 additions and 1466 deletions
+8 -3
View File
@@ -6,6 +6,7 @@ import { sendMail } from 'emailer';
import * as errors from '@@/custom-errors';
import { originMiddleware } from '@@/_middlewares';
import { updateUserHandler } from './update-user';
import { deprovisionLinuxUser } from './provision';
export const usersRouter = createRouter();
usersRouter.use(originMiddleware);
@@ -35,9 +36,10 @@ usersRouter.post('/invite', async (ctx) => {
}
const validRoles = USER_ROLES.filter((r) => r !== 'Super Admin');
const assignedRole = (typeof role === 'string' && validRoles.includes(role as (typeof validRoles)[number]))
? (role as (typeof USER_ROLES)[number])
: ('Member' as const);
const assignedRole =
typeof role === 'string' && validRoles.includes(role as (typeof validRoles)[number])
? (role as (typeof USER_ROLES)[number])
: ('Member' as const);
const existing = await getUserByEmail(email);
if (existing) throw errors.CONFLICT('A user with this email already exists');
@@ -101,6 +103,9 @@ usersRouter.delete('/:id', async (ctx) => {
const target = await getUserById(id);
if (!target) throw errors.NOT_FOUND('User not found');
// Deprovision Linux user before deleting from database
deprovisionLinuxUser(target.email, target.username ?? '');
await deleteUser(id);
return ctx.json({ ok: true });
});