diff --git a/.changeset/gorgeous-rules-protect.md b/.changeset/gorgeous-rules-protect.md new file mode 100644 index 00000000000..2a110c1b3a1 --- /dev/null +++ b/.changeset/gorgeous-rules-protect.md @@ -0,0 +1,5 @@ +--- +"@thirdweb-dev/service-utils": patch +--- + +catch cache puts for auth in cf workers diff --git a/packages/service-utils/src/cf-worker/index.ts b/packages/service-utils/src/cf-worker/index.ts index f669427c0a4..6eeb4e18a05 100644 --- a/packages/service-utils/src/cf-worker/index.ts +++ b/packages/service-utils/src/cf-worker/index.ts @@ -59,20 +59,24 @@ export async function authorizeWorker( get: async (clientId: string) => serviceConfig.kvStore.get(clientId), put: (clientId: string, teamAndProjectResponse: TeamAndProjectResponse) => serviceConfig.ctx.waitUntil( - serviceConfig.kvStore.put( - clientId, - JSON.stringify({ - updatedAt: Date.now(), - teamAndProjectResponse, - } satisfies TeamAndProjectCacheWithPossibleTTL), - { - expirationTtl: - serviceConfig.cacheTtlSeconds && - serviceConfig.cacheTtlSeconds >= DEFAULT_CACHE_TTL_SECONDS - ? serviceConfig.cacheTtlSeconds - : DEFAULT_CACHE_TTL_SECONDS, - }, - ), + serviceConfig.kvStore + .put( + clientId, + JSON.stringify({ + updatedAt: Date.now(), + teamAndProjectResponse, + } satisfies TeamAndProjectCacheWithPossibleTTL), + { + expirationTtl: + serviceConfig.cacheTtlSeconds && + serviceConfig.cacheTtlSeconds >= DEFAULT_CACHE_TTL_SECONDS + ? serviceConfig.cacheTtlSeconds + : DEFAULT_CACHE_TTL_SECONDS, + }, + ) + .catch((e) => { + console.warn(e); + }), ), cacheTtlSeconds: serviceConfig.cacheTtlSeconds ?? DEFAULT_CACHE_TTL_SECONDS, });