Skip to content

Commit

Permalink
chore(zero-cache): surface auth token failures in error message (#3447)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkgnotic authored Dec 22, 2024
1 parent f5ccee6 commit 3e31949
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/zero-cache/src/workers/syncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {MessagePort} from 'worker_threads';
import {WebSocketServer, type WebSocket} from 'ws';
import {promiseVoid} from '../../../shared/src/resolved-promises.js';
import {ErrorKind} from '../../../zero-protocol/src/error.js';
import {verifyToken} from '../auth/jwt.js';
import {type AuthConfig, type ZeroConfig} from '../config/zero-config.js';
import type {ConnectParams} from '../services/dispatcher/connect-params.js';
import {installWebSocketReceiver} from '../services/dispatcher/websocket-handoff.js';
Expand All @@ -23,7 +24,6 @@ import type {Worker} from '../types/processes.js';
import {Subscription} from '../types/subscription.js';
import {Connection, sendError} from './connection.js';
import {createNotifierFrom, subscribeTo} from './replicator.js';
import {verifyToken} from '../auth/jwt.js';

export type SyncerWorkerData = {
replicatorPort: MessagePort;
Expand Down Expand Up @@ -94,7 +94,7 @@ export class Syncer implements SingletonService {
} catch (e) {
sendError(this.#lc, ws, {
kind: ErrorKind.AuthInvalidated,
message: 'Failed to decode auth token',
message: `Failed to decode auth token: ${String(e)}`,
});
ws.close(3000, 'Failed to decode JWT');
}
Expand Down

0 comments on commit 3e31949

Please sign in to comment.