diff --git a/apps/api/src/routes/v1_keys_updateKey.error.test.ts b/apps/api/src/routes/v1_keys_updateKey.error.test.ts index a3dd304e71..72ed1c5367 100644 --- a/apps/api/src/routes/v1_keys_updateKey.error.test.ts +++ b/apps/api/src/routes/v1_keys_updateKey.error.test.ts @@ -88,8 +88,8 @@ test("when the key has been deleted", async (t) => { start: "test", name: "test", hash: await sha256(new KeyV1({ byteLength: 16 }).toString()), - createdAt: new Date(), - deletedAt: new Date(), + createdAtM: Date.now(), + deletedAtM: Date.now(), }; await h.db.primary.insert(schema.keys).values(key); @@ -106,7 +106,7 @@ test("when the key has been deleted", async (t) => { enabled: false, }, }); - expect(res.status).toEqual(404); + expect(res.status, `Expected 404, got: ${JSON.stringify(res)}`).toEqual(404); expect(res.body).toMatchObject({ error: { code: "NOT_FOUND", diff --git a/apps/api/src/routes/v1_keys_verifyKey.test.ts b/apps/api/src/routes/v1_keys_verifyKey.test.ts index 0aae902383..56e4c4c99d 100644 --- a/apps/api/src/routes/v1_keys_verifyKey.test.ts +++ b/apps/api/src/routes/v1_keys_verifyKey.test.ts @@ -38,6 +38,34 @@ test("returns 200", async (t) => { expect(res.body.valid).toBe(true); }); +test("returns a requestId", async (t) => { + const h = await IntegrationHarness.init(t); + + const key = new KeyV1({ prefix: "test", byteLength: 16 }).toString(); + await h.db.primary.insert(schema.keys).values({ + id: newId("test"), + keyAuthId: h.resources.userKeyAuth.id, + hash: await sha256(key), + start: key.slice(0, 8), + workspaceId: h.resources.userWorkspace.id, + createdAtM: Date.now(), + }); + + const res = await h.post({ + url: "/v1/keys.verifyKey", + headers: { + "Content-Type": "application/json", + }, + body: { + key, + apiId: h.resources.userApi.id, + }, + }); + + expect(res.status, `expected 200, received: ${JSON.stringify(res, null, 2)}`).toBe(200); + expect(res.body.requestId).toBeDefined(); +}); + describe("bad request", () => { test("returns 400", async (t) => { const h = await IntegrationHarness.init(t); diff --git a/apps/api/src/routes/v1_keys_verifyKey.ts b/apps/api/src/routes/v1_keys_verifyKey.ts index 743174657b..9f5dc84c8d 100644 --- a/apps/api/src/routes/v1_keys_verifyKey.ts +++ b/apps/api/src/routes/v1_keys_verifyKey.ts @@ -296,6 +296,10 @@ These are validation codes, the HTTP status will be 200. .openapi({ description: "The associated identity of this key.", }), + requestId: z.string().openapi({ + description: + "A unique id for this request, please provide it to Unkey support to help us debug your issue.", + }), }) .openapi("V1KeysVerifyKeyResponse"), }, @@ -354,6 +358,7 @@ export const registerV1KeysVerifyKey = (app: App) => return c.json({ valid: false, code: val.code, + requestId: c.get("requestId"), }); } @@ -377,6 +382,7 @@ export const registerV1KeysVerifyKey = (app: App) => meta: val.identity.meta ?? {}, } : undefined, + requestId: c.get("requestId"), }; c.executionCtx.waitUntil( analytics diff --git a/apps/api/src/routes/v1_migrations_createKey.happy.test.ts b/apps/api/src/routes/v1_migrations_createKey.happy.test.ts index c67d17636a..dafa1ba8b1 100644 --- a/apps/api/src/routes/v1_migrations_createKey.happy.test.ts +++ b/apps/api/src/routes/v1_migrations_createKey.happy.test.ts @@ -292,6 +292,8 @@ describe("roles", () => { const root = await h.createRootKey([`api.${h.resources.userApi.id}.create_key`]); + const plaintext = crypto.randomUUID(); + const res = await h.post({ url: "/v1/migrations.createKeys", headers: { @@ -301,7 +303,7 @@ describe("roles", () => { body: [ { start: "start_", - plaintext: "plaintext", + plaintext, apiId: h.resources.userApi.id, permissions, }, diff --git a/apps/www/app/careers/page.tsx b/apps/www/app/careers/page.tsx index 2e04dcbf15..abf90e2eab 100644 --- a/apps/www/app/careers/page.tsx +++ b/apps/www/app/careers/page.tsx @@ -64,8 +64,7 @@ export default async function Careers() {

Open Positions

- Unkey is 100% remote. We currently live in Germany, Turkey and the United - States. + Unkey is 100% remote. We currently live in Germany, Turkey and the United States.