Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(nuq): normalize non-UUID team IDs into real UUID owner IDs

Gergő Móriczd763d0cbe26b
diff --git a/apps/api/package.json b/apps/api/package.json
index 303b87e8b..404e738e2 100644
--- a/apps/api/package.json
+++ b/apps/api/package.json
@@ -136,7 +136,7 @@
"tough-cookie": "^4.1.4",
"turndown": "^7.1.3",
"undici": "^7.10.0",
- "uuid": "^10.0.0",
+ "uuid": "^13.0.0",
"winston": "^3.14.2",
"ws": "^8.18.0",
"x402-express": "^0.6.5",
diff --git a/apps/api/pnpm-lock.yaml b/apps/api/pnpm-lock.yaml
index d0be91535..54b9eebfd 100644
--- a/apps/api/pnpm-lock.yaml
+++ b/apps/api/pnpm-lock.yaml
@@ -224,8 +224,8 @@ importers:
specifier: ^7.10.0
version: 7.10.0
uuid:
- specifier: ^10.0.0
- version: 10.0.0
+ specifier: ^13.0.0
+ version: 13.0.0
winston:
specifier: ^3.14.2
version: 3.14.2
@@ -6744,8 +6744,8 @@ packages:
resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==}
engines: {node: '>= 0.4.0'}
- resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==}
+ resolution: {integrity: sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==}
hasBin: true
@@ -7530,7 +7530,7 @@ snapshots:
idb-keyval: 6.2.1
preact: 10.24.2
transitivePeerDependencies:
- '@types/react'
@@ -7604,7 +7604,7 @@ snapshots:
idb-keyval: 6.2.1
preact: 10.24.2
transitivePeerDependencies:
- '@types/react'
@@ -7807,11 +7807,11 @@ snapshots:
ethereum-cryptography: 2.2.1
micro-ftch: 0.3.1
dependencies:
'@metamask/rpc-errors': 7.0.2
eventemitter3: 5.0.1
transitivePeerDependencies:
- supports-color
@@ -9851,7 +9851,7 @@ snapshots:
dependencies:
big.js: 6.2.2
dayjs: 1.11.13
transitivePeerDependencies:
- bufferutil
- typescript
@@ -9864,7 +9864,7 @@ snapshots:
'@reown/appkit-wallet': 1.7.8([email protected])([email protected])([email protected])
valtio: 1.13.2([email protected])
transitivePeerDependencies:
- '@azure/app-configuration'
- '@azure/cosmos'
@@ -10010,7 +10010,7 @@ snapshots:
'@walletconnect/logger': 2.1.2
valtio: 1.13.2([email protected])
transitivePeerDependencies:
- '@azure/app-configuration'
- '@azure/cosmos'
@@ -10063,7 +10063,7 @@ snapshots:
bs58: 6.0.0
valtio: 1.13.2([email protected])
transitivePeerDependencies:
- '@azure/app-configuration'
- '@azure/cosmos'
@@ -10104,7 +10104,7 @@ snapshots:
dependencies:
'@safe-global/safe-gateway-typescript-sdk': 3.23.1
transitivePeerDependencies:
- bufferutil
- typescript
@@ -11063,19 +11063,19 @@ snapshots:
dependencies:
'@types/yargs-parser': 21.0.3
dependencies:
'@safe-global/safe-apps-provider': 0.18.6([email protected])([email protected])([email protected])([email protected])
cbw-sdk: '@coinbase/[email protected]'
optionalDependencies:
typescript: 5.8.3
transitivePeerDependencies:
@@ -11109,11 +11109,11 @@ snapshots:
- wagmi
- zod
dependencies:
eventemitter3: 5.0.1
mipd: 0.0.7([email protected])
optionalDependencies:
'@tanstack/query-core': 5.83.1
@@ -11661,11 +11661,6 @@ snapshots:
typescript: 5.8.3
zod: 3.22.4
- optionalDependencies:
- typescript: 5.8.3
- zod: 3.24.2
-
optionalDependencies:
typescript: 5.8.3
@@ -11676,11 +11671,6 @@ snapshots:
typescript: 5.8.3
zod: 3.22.4
- optionalDependencies:
- typescript: 5.8.3
- zod: 3.24.2
-
optionalDependencies:
typescript: 5.8.3
@@ -14152,21 +14142,6 @@ snapshots:
transitivePeerDependencies:
- zod
- dependencies:
- '@adraffy/ens-normalize': 1.11.1
- '@noble/ciphers': 1.3.0
- '@noble/curves': 1.9.6
- '@noble/hashes': 1.8.0
- '@scure/bip32': 1.7.0
- '@scure/bip39': 1.6.0
- eventemitter3: 5.0.1
- optionalDependencies:
- typescript: 5.8.3
- transitivePeerDependencies:
- - zod
-
dependencies:
'@adraffy/ens-normalize': 1.11.1
@@ -14406,21 +14381,21 @@ snapshots:
dependencies:
hono: 4.9.10
idb-keyval: 6.2.2
mipd: 0.0.7([email protected])
zod: 4.1.11
optionalDependencies:
'@tanstack/react-query': 5.84.1([email protected])
react: 18.3.1
typescript: 5.8.3
transitivePeerDependencies:
- '@types/react'
- immer
@@ -15292,7 +15267,7 @@ snapshots:
@@ -15350,23 +15325,6 @@ snapshots:
- utf-8-validate
- zod
- dependencies:
- '@noble/curves': 1.9.2
- '@noble/hashes': 1.8.0
- '@scure/bip32': 1.7.0
- '@scure/bip39': 1.6.0
- optionalDependencies:
- typescript: 5.8.3
- transitivePeerDependencies:
- - bufferutil
- - utf-8-validate
- - zod
-
dependencies:
'@noble/curves': 1.9.2
@@ -15388,14 +15346,14 @@ snapshots:
dependencies:
xml-name-validator: 5.0.0
dependencies:
'@tanstack/react-query': 5.84.1([email protected])
react: 18.3.1
use-sync-external-store: 1.4.0([email protected])
optionalDependencies:
typescript: 5.8.3
transitivePeerDependencies:
@@ -15602,8 +15560,8 @@ snapshots:
zod: 3.25.76
transitivePeerDependencies:
- '@azure/app-configuration'
diff --git a/apps/api/src/services/worker/nuq.ts b/apps/api/src/services/worker/nuq.ts
index e187f035e..2cf95c4b5 100644
--- a/apps/api/src/services/worker/nuq.ts
+++ b/apps/api/src/services/worker/nuq.ts
@@ -4,6 +4,7 @@ import { Client, Pool } from "pg";
import { type ScrapeJobData } from "../../types";
import { withSpan, setSpanAttributes } from "../../lib/otel-tracer";
import amqp from "amqplib";
+import { v5 as uuidv5, validate as uuidValidate } from "uuid";
// === Basics
@@ -522,6 +523,13 @@ class NuQ<JobData = any, JobReturnValue = any> {
options: NuQJobOptions = {},
): Promise<NuQJob<JobData, JobReturnValue>> {
return withSpan("nuq.addJob", async span => {
+ const bareOwnerId = options.ownerId ?? undefined;
+ const normalizedOwnerId = bareOwnerId
+ ? uuidValidate(bareOwnerId)
+ ? bareOwnerId
+ : uuidv5(bareOwnerId, "b208cbac-8bdf-4599-bf17-da78426e3f7c") // preview namespace
+ : null;
+
setSpanAttributes(span, {
"nuq.queue_name": this.queueName,
"nuq.job_id": id,
@@ -541,7 +549,7 @@ class NuQ<JobData = any, JobReturnValue = any> {
data,
options.priority ?? 0,
options.listenable ? listenChannelId : null,
- options.ownerId ?? null,
+ normalizedOwnerId ?? null,
],
)
).rows[0],