Events 3.5.0, contracts 1.13.0, agent 1.3.1: demo data keeps the Accounts link; sign-in health for the Hub
- Events: loading demo data emptied ProductLink but kept auth_mode, so a site in Accounts mode had no link and nobody could sign in (ACCOUNTS_UNAVAILABLE on events-demo). set-demo.js keeps ProductLink and LinkNonce; a site in Accounts mode without a link reconnects at its next heartbeat; sign-in failures are kept and sent in the heartbeat (stats.signIn). - Contracts 1.13.0: stats.signIn in the Cross Events heartbeat. - Agent 1.3.1: 1.3.0 reported itself as 1.2.0 (AGENT_VERSION not bumped). - What's New notes for Events 3.4.0 / 3.5.0 and Accounts 1.4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import { siteUrl } from '../feed/context';
|
||||
import { accounts, AccountsUnavailable } from './client';
|
||||
import { viaAccounts } from './mode';
|
||||
import { handleAccountsCall } from './calls';
|
||||
import { clearSignInError, recordSignInError } from './status';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-require-imports -- CommonJS */
|
||||
const prisma = require('../config/db');
|
||||
@@ -144,7 +145,10 @@ async function startSignIn(req: Request, res: Response) {
|
||||
return res.redirect(303, url);
|
||||
} catch (e) {
|
||||
console.warn('[accounts] sign-in could not start:', (e as Error).message);
|
||||
return problem(res, e instanceof AccountsUnavailable ? 'ACCOUNTS_UNAVAILABLE' : 'START_FAILED', returnTo);
|
||||
const failed = e instanceof AccountsUnavailable ? 'ACCOUNTS_UNAVAILABLE' : 'START_FAILED';
|
||||
// 3.5.0: the reason goes to the Hub with the next heartbeat (the page only says "try again").
|
||||
await recordSignInError(failed, (e as Error).message);
|
||||
return problem(res, failed, returnTo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +162,8 @@ async function callback(req: Request, res: Response) {
|
||||
let auth;
|
||||
try {
|
||||
auth = await accounts();
|
||||
} catch {
|
||||
} catch (e) {
|
||||
await recordSignInError('ACCOUNTS_UNAVAILABLE', (e as Error).message);
|
||||
return problem(res, 'ACCOUNTS_UNAVAILABLE');
|
||||
}
|
||||
let signed;
|
||||
@@ -168,8 +173,10 @@ async function callback(req: Request, res: Response) {
|
||||
} catch (e) {
|
||||
const code = (e as { code?: string }).code;
|
||||
console.warn('[accounts] sign-in could not finish:', (e as Error).message);
|
||||
if (code !== 'NO_PENDING') await recordSignInError('FINISH_FAILED', (e as Error).message);
|
||||
return problem(res, code === 'NO_PENDING' ? 'EXPIRED' : 'FINISH_FAILED');
|
||||
}
|
||||
await clearSignInError();
|
||||
const { claims, returnTo, idToken } = signed;
|
||||
|
||||
const found = await userForClaims(claims);
|
||||
|
||||
Reference in New Issue
Block a user