fix(worker-auth): unify token checks and bind job environment

This commit is contained in:
Gabriel Brown
2026-07-10 17:06:33 -04:00
parent feb3723753
commit 020ffbfb23
6 changed files with 138 additions and 37 deletions
+11
View File
@@ -0,0 +1,11 @@
import { ConvexError } from 'convex/values';
export const assertWorkerToken = (provided: string): void => {
const expected = process.env.SPOON_WORKER_TOKEN?.trim();
if (!expected) {
throw new ConvexError('SPOON_WORKER_TOKEN is not configured.');
}
if (provided.trim() !== expected) {
throw new ConvexError('Invalid worker token.');
}
};