From be3dc5b42d9a644bdb607cbbf4832d88c09c8aa6 Mon Sep 17 00:00:00 2001 From: Harsh Shrikant Bhat <90265455+harshsbhat@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:36:04 +0530 Subject: [PATCH 1/4] chore: add catch block after every db transaction --- apps/dashboard/lib/trpc/routers/api/create.ts | 80 +++++----- .../lib/trpc/routers/api/setDefaultBytes.ts | 70 +++++---- .../lib/trpc/routers/api/setDefaultPrefix.ts | 70 +++++---- .../routers/api/updateDeleteProtection.ts | 78 +++++----- .../lib/trpc/routers/api/updateIpWhitelist.ts | 70 +++++---- .../lib/trpc/routers/api/updateName.ts | 70 +++++---- .../lib/trpc/routers/key/updateEnabled.ts | 70 +++++---- .../lib/trpc/routers/key/updateExpiration.ts | 78 +++++----- .../lib/trpc/routers/key/updateMetadata.ts | 70 +++++---- .../lib/trpc/routers/key/updateName.ts | 70 +++++---- .../lib/trpc/routers/key/updateOwnerId.ts | 70 +++++---- .../lib/trpc/routers/key/updateRootKeyName.ts | 70 +++++---- .../lib/trpc/routers/llmGateway/delete.ts | 64 ++++---- .../trpc/routers/ratelimit/deleteOverride.ts | 6 + .../trpc/routers/ratelimit/updateOverride.ts | 84 ++++++----- .../routers/rbac/addPermissionToRootKey.ts | 82 ++++++----- .../routers/rbac/connectPermissionToRole.ts | 72 +++++---- .../lib/trpc/routers/rbac/connectRoleToKey.ts | 72 +++++---- .../lib/trpc/routers/rbac/createPermission.ts | 7 + .../lib/trpc/routers/rbac/createRole.ts | 137 +++++++++--------- .../lib/trpc/routers/rbac/upsertPermission.ts | 6 + .../lib/trpc/routers/workspace/changeName.ts | 74 +++++----- .../lib/trpc/routers/workspace/changePlan.ts | 58 ++++---- 23 files changed, 853 insertions(+), 675 deletions(-) diff --git a/apps/dashboard/lib/trpc/routers/api/create.ts b/apps/dashboard/lib/trpc/routers/api/create.ts index 434b618b85..04e109f0fb 100644 --- a/apps/dashboard/lib/trpc/routers/api/create.ts +++ b/apps/dashboard/lib/trpc/routers/api/create.ts @@ -50,46 +50,54 @@ export const createApi = rateLimitedProcedure(ratelimit.create) const apiId = newId("api"); - await db.transaction(async (tx) => { - await tx - .insert(schema.apis) - .values({ - id: apiId, - name: input.name, - workspaceId: ws.id, - keyAuthId, - authType: "key", - ipWhitelist: null, - createdAt: new Date(), - }) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to create the API. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .insert(schema.apis) + .values({ + id: apiId, + name: input.name, + workspaceId: ws.id, + keyAuthId, + authType: "key", + ipWhitelist: null, + createdAt: new Date(), + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to create the API. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: ws.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "api.create", - description: `Created ${apiId}`, - resources: [ - { - type: "api", - id: apiId, + await insertAuditLogs(tx, { + workspaceId: ws.id, + actor: { + type: "user", + id: ctx.user.id, + }, + event: "api.create", + description: `Created ${apiId}`, + resources: [ + { + type: "api", + id: apiId, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to create the API. Please contact support using support@unkey.dev", + }); }); - }); return { id: apiId, diff --git a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts index 4b5fb13b54..d8f5bdfd25 100644 --- a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts +++ b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts @@ -36,38 +36,46 @@ export const setDefaultApiBytes = rateLimitedProcedure(ratelimit.update) "We are unable to find the correct keyAuth. Please contact support using support@unkey.dev", }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keyAuth) - .set({ - defaultBytes: input.defaultBytes, - }) - .where(eq(schema.keyAuth.id, input.keyAuthId)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to update the API default bytes. Please contact support using support@unkey.dev.", + await db + .transaction(async (tx) => { + await tx + .update(schema.keyAuth) + .set({ + defaultBytes: input.defaultBytes, + }) + .where(eq(schema.keyAuth.id, input.keyAuthId)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update the API default bytes. Please contact support using support@unkey.dev.", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: keyAuth.workspaceId, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "api.update", - description: `Changed ${keyAuth.workspaceId} default byte size for keys from ${keyAuth.defaultBytes} to ${input.defaultBytes}`, - resources: [ - { - type: "keyAuth", - id: keyAuth.id, + await insertAuditLogs(tx, { + workspaceId: keyAuth.workspaceId, + actor: { + type: "user", + id: ctx.user.id, + }, + event: "api.update", + description: `Changed ${keyAuth.workspaceId} default byte size for keys from ${keyAuth.defaultBytes} to ${input.defaultBytes}`, + resources: [ + { + type: "keyAuth", + id: keyAuth.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were update the default bytes. Please contact support using support@unkey.dev.", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts b/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts index 035af31609..58f4640ae9 100644 --- a/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts +++ b/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts @@ -32,38 +32,46 @@ export const setDefaultApiPrefix = rateLimitedProcedure(ratelimit.update) "We are unable to find the correct keyAuth. Please contact support using support@unkey.dev", }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keyAuth) - .set({ - defaultPrefix: input.defaultPrefix, - }) - .where(eq(schema.keyAuth.id, input.keyAuthId)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to update the API default prefix. Please contact support using support@unkey.dev.", + await db + .transaction(async (tx) => { + await tx + .update(schema.keyAuth) + .set({ + defaultPrefix: input.defaultPrefix, + }) + .where(eq(schema.keyAuth.id, input.keyAuthId)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update the API default prefix. Please contact support using support@unkey.dev.", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: keyAuth.workspaceId, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "api.update", - description: `Changed ${keyAuth.workspaceId} default prefix from ${keyAuth.defaultPrefix} to ${input.defaultPrefix}`, - resources: [ - { - type: "keyAuth", - id: keyAuth.id, + await insertAuditLogs(tx, { + workspaceId: keyAuth.workspaceId, + actor: { + type: "user", + id: ctx.user.id, + }, + event: "api.update", + description: `Changed ${keyAuth.workspaceId} default prefix from ${keyAuth.defaultPrefix} to ${input.defaultPrefix}`, + resources: [ + { + type: "keyAuth", + id: keyAuth.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update the default prefix. Please contact support using support@unkey.dev.", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts b/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts index 2306ca17b4..368f23aa60 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts @@ -36,43 +36,51 @@ export const updateAPIDeleteProtection = rateLimitedProcedure(ratelimit.update) }); } - await db.transaction(async (tx) => { - await tx - .update(schema.apis) - .set({ - deleteProtection: input.enabled, - }) - .where(eq(schema.apis.id, input.apiId)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to update the API. Please contact support using support@unkey.dev.", + await db + .transaction(async (tx) => { + await tx + .update(schema.apis) + .set({ + deleteProtection: input.enabled, + }) + .where(eq(schema.apis.id, input.apiId)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update the API. Please contact support using support@unkey.dev.", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: api.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "api.update", - description: `API ${api.name} delete protection is now ${ - input.enabled ? "enabled" : "disabled" - }.}`, - resources: [ - { - type: "api", - id: api.id, - meta: { - deleteProtection: input.enabled, + await insertAuditLogs(tx, { + workspaceId: api.workspace.id, + actor: { + type: "user", + id: ctx.user.id, + }, + event: "api.update", + description: `API ${api.name} delete protection is now ${ + input.enabled ? "enabled" : "disabled" + }.}`, + resources: [ + { + type: "api", + id: api.id, + meta: { + deleteProtection: input.enabled, + }, }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update the API. Please contact support using support@unkey.dev", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts b/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts index b7dc45041b..513e6d7840 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts @@ -53,38 +53,46 @@ export const updateApiIpWhitelist = rateLimitedProcedure(ratelimit.update) const newIpWhitelist = input.ipWhitelist === null ? null : input.ipWhitelist.join(","); - await db.transaction(async (tx) => { - await tx - .update(schema.apis) - .set({ - ipWhitelist: newIpWhitelist, - }) - .where(eq(schema.apis.id, input.apiId)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to update the API whitelist. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.apis) + .set({ + ipWhitelist: newIpWhitelist, + }) + .where(eq(schema.apis.id, input.apiId)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update the API whitelist. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: api.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "api.update", - description: `Changed ${api.id} IP whitelist from ${api.ipWhitelist} to ${newIpWhitelist}`, - resources: [ - { - type: "api", - id: api.id, + await insertAuditLogs(tx, { + workspaceId: api.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "api.update", + description: `Changed ${api.id} IP whitelist from ${api.ipWhitelist} to ${newIpWhitelist}`, + resources: [ + { + type: "api", + id: api.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update the API whitelist. Please contact support using support@unkey.dev", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/updateName.ts b/apps/dashboard/lib/trpc/routers/api/updateName.ts index a054eefd43..f77153eed7 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateName.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateName.ts @@ -36,38 +36,46 @@ export const updateApiName = rateLimitedProcedure(ratelimit.update) "We are unable to find the correct API. Please contact support using support@unkey.dev.", }); } - await db.transaction(async (tx) => { - await tx - .update(schema.apis) - .set({ - name: input.name, - }) - .where(eq(schema.apis.id, input.apiId)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to update the API name. Please contact support using support@unkey.dev.", + await db + .transaction(async (tx) => { + await tx + .update(schema.apis) + .set({ + name: input.name, + }) + .where(eq(schema.apis.id, input.apiId)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update the API name. Please contact support using support@unkey.dev.", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: api.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "api.update", - description: `Changed ${api.id} name from ${api.name} to ${input.name}`, - resources: [ - { - type: "api", - id: api.id, + await insertAuditLogs(tx, { + workspaceId: api.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "api.update", + description: `Changed ${api.id} name from ${api.name} to ${input.name}`, + resources: [ + { + type: "api", + id: api.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update the API name. Please contact support using support@unkey.dev.", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts b/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts index 92a5ced6a9..328814a3b3 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts @@ -35,38 +35,46 @@ export const updateKeyEnabled = rateLimitedProcedure(ratelimit.update) }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keys) - .set({ - enabled: input.enabled, - }) - .where(eq(schema.keys.id, key.id)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to update enabled on this key. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.keys) + .set({ + enabled: input.enabled, + }) + .where(eq(schema.keys.id, key.id)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update enabled on this key. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: key.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "key.update", - description: `${input.enabled ? "Enabled" : "Disabled"} ${key.id}`, - resources: [ - { - type: "key", - id: key.id, + await insertAuditLogs(tx, { + workspaceId: key.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "key.update", + description: `${input.enabled ? "Enabled" : "Disabled"} ${key.id}`, + resources: [ + { + type: "key", + id: key.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update enabled on this key. Please contact support using support@unkey.dev", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts b/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts index c49f677fda..d46a138cca 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts @@ -55,44 +55,52 @@ export const updateKeyExpiration = rateLimitedProcedure(ratelimit.update) code: "NOT_FOUND", }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keys) - .set({ - expires, - }) - .where(eq(schema.keys.id, key.id)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to update expiration on this key. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.keys) + .set({ + expires, + }) + .where(eq(schema.keys.id, key.id)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update expiration on this key. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: key.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "key.update", - description: `${ - input.expiration - ? `Changed expiration of ${key.id} to ${input.expiration.toUTCString()}` - : `Disabled expiration for ${key.id}` - }`, - resources: [ - { - type: "key", - id: key.id, + await insertAuditLogs(tx, { + workspaceId: key.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "key.update", + description: `${ + input.expiration + ? `Changed expiration of ${key.id} to ${input.expiration.toUTCString()}` + : `Disabled expiration for ${key.id}` + }`, + resources: [ + { + type: "key", + id: key.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update expiration on this key. Please contact support using support@unkey.dev", + }); }); - }); return true; }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts b/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts index 949f02acde..26aaecee00 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts @@ -48,40 +48,48 @@ export const updateKeyMetadata = rateLimitedProcedure(ratelimit.update) code: "NOT_FOUND", }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keys) - .set({ - meta: meta ? JSON.stringify(meta) : null, - }) - .where(eq(schema.keys.id, key.id)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to update metadata on this key. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.keys) + .set({ + meta: meta ? JSON.stringify(meta) : null, + }) + .where(eq(schema.keys.id, key.id)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update metadata on this key. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: key.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "key.update", - description: `Updated metadata of ${key.id}`, - resources: [ - { - type: "key", - id: key.id, + await insertAuditLogs(tx, { + workspaceId: key.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "key.update", + description: `Updated metadata of ${key.id}`, + resources: [ + { + type: "key", + id: key.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update metadata on this key. Please contact support using support@unkey.dev", + }); }); - }); return true; }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateName.ts b/apps/dashboard/lib/trpc/routers/key/updateName.ts index 23ab0d1a9f..70a110ca1b 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateName.ts @@ -36,40 +36,48 @@ export const updateKeyName = rateLimitedProcedure(ratelimit.update) code: "NOT_FOUND", }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keys) - .set({ - name: input.name ?? null, - }) - .where(eq(schema.keys.id, key.id)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to update name on this key. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.keys) + .set({ + name: input.name ?? null, + }) + .where(eq(schema.keys.id, key.id)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update name on this key. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: key.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "key.update", - description: `Changed name of ${key.id} to ${input.name}`, - resources: [ - { - type: "key", - id: key.id, + await insertAuditLogs(tx, { + workspaceId: key.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "key.update", + description: `Changed name of ${key.id} to ${input.name}`, + resources: [ + { + type: "key", + id: key.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update name on this key. Please contact support using support@unkey.dev", + }); }); - }); return true; }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts index 7fb8a5b807..72a75036a4 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts @@ -36,40 +36,48 @@ export const updateKeyOwnerId = rateLimitedProcedure(ratelimit.update) }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keys) - .set({ - ownerId: input.ownerId ?? null, - }) - .where(eq(schema.keys.id, key.id)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to update ownerId on this key. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.keys) + .set({ + ownerId: input.ownerId ?? null, + }) + .where(eq(schema.keys.id, key.id)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update ownerId on this key. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: key.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "key.update", - description: `Changed ownerId of ${key.id} to ${input.ownerId}`, - resources: [ - { - type: "key", - id: key.id, + await insertAuditLogs(tx, { + workspaceId: key.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "key.update", + description: `Changed ownerId of ${key.id} to ${input.ownerId}`, + resources: [ + { + type: "key", + id: key.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We were unable to update ownerId on this key. Please contact support using support@unkey.dev", + }); }); - }); return true; }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts index 79c4978e01..11a08bc681 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts @@ -48,38 +48,46 @@ export const updateRootKeyName = t.procedure }); } - await db.transaction(async (tx) => { - await tx - .update(schema.keys) - .set({ - name: input.name ?? null, - }) - .where(eq(schema.keys.id, key.id)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to update root key name. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.keys) + .set({ + name: input.name ?? null, + }) + .where(eq(schema.keys.id, key.id)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update root key name. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "key.update", - description: `Changed name of ${key.id} to ${input.name}`, - resources: [ - { - type: "key", - id: key.id, + await insertAuditLogs(tx, { + workspaceId: workspace.id, + actor: { + type: "user", + id: ctx.user.id, + }, + event: "key.update", + description: `Changed name of ${key.id} to ${input.name}`, + resources: [ + { + type: "key", + id: key.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update root key name. Please contact support using support@unkey.dev", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts b/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts index 6b9467eb0e..f9cf66c250 100644 --- a/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts +++ b/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts @@ -35,37 +35,45 @@ export const deleteLlmGateway = rateLimitedProcedure(ratelimit.delete) }); } - await db.transaction(async (tx) => { - await tx - .delete(schema.llmGateways) - .where(eq(schema.llmGateways.id, input.gatewayId)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to delete the LLM gateway. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .delete(schema.llmGateways) + .where(eq(schema.llmGateways.id, input.gatewayId)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to delete the LLM gateway. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: llmGateway.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "llmGateway.delete", - description: `Deleted ${llmGateway.id}`, - resources: [ - { - type: "gateway", - id: llmGateway.id, + await insertAuditLogs(tx, { + workspaceId: llmGateway.workspace.id, + actor: { + type: "user", + id: ctx.user.id, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + event: "llmGateway.delete", + description: `Deleted ${llmGateway.id}`, + resources: [ + { + type: "gateway", + id: llmGateway.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to delete LLM gateway. Please contact support using support@unkey.dev", + }); }); - }); return { id: llmGateway.id, diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts index 795dac6a45..70740587d9 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts @@ -81,6 +81,12 @@ export const deleteOverride = rateLimitedProcedure(ratelimit.create) location: ctx.audit.location, userAgent: ctx.audit.userAgent, }, + }).catch((_err) => { + throw new TRPCError({ + message: + "We are unable to delete the override. Please contact support using support@unkey.dev", + code: "INTERNAL_SERVER_ERROR", + }); }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts index a404348a03..108509e4cf 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts @@ -50,51 +50,59 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) }); } - await db.transaction(async (tx) => { - await tx - .update(schema.ratelimitOverrides) - .set({ - limit: input.limit, - duration: input.duration, - updatedAt: new Date(), - async: input.async, - }) - .where(eq(schema.ratelimitOverrides.id, override.id)) - .catch((_err) => { + await db + .transaction(async (tx) => { + await tx + .update(schema.ratelimitOverrides) + .set({ + limit: input.limit, + duration: input.duration, + updatedAt: new Date(), + async: input.async, + }) + .where(eq(schema.ratelimitOverrides.id, override.id)) + .catch((_err) => { + throw new TRPCError({ + message: + "We are unable to update the override. Please contact support using support@unkey.dev.", + code: "INTERNAL_SERVER_ERROR", + }); + }); + await insertAuditLogs(tx, { + workspaceId: override.namespace.workspace.id, + actor: { + type: "user", + id: ctx.user.id, + }, + event: "ratelimitOverride.update", + description: `Changed ${override.id} limits from ${override.limit}/${override.duration} to ${input.limit}/${input.duration}`, + resources: [ + { + type: "ratelimitNamespace", + id: override.namespace.id, + }, + { + type: "ratelimitOverride", + id: override.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, + }, + }).catch((_err) => { throw new TRPCError({ - message: - "We are unable to update the override. Please contact support using support@unkey.dev.", code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update the override. Please contact support using support@unkey.dev", }); }); - await insertAuditLogs(tx, { - workspaceId: override.namespace.workspace.id, - actor: { - type: "user", - id: ctx.user.id, - }, - event: "ratelimitOverride.update", - description: `Changed ${override.id} limits from ${override.limit}/${override.duration} to ${input.limit}/${input.duration}`, - resources: [ - { - type: "ratelimitNamespace", - id: override.namespace.id, - }, - { - type: "ratelimitOverride", - id: override.id, - }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, - }).catch((_err) => { + }) + .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the override. Please contact support using support@unkey.dev", + "We are unable to update this override for this namespae. Please contact support using support@unkey.dev", }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts b/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts index 3ed8fa5ed3..6e6f5b097b 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts @@ -65,44 +65,52 @@ export const addPermissionToRootKey = rateLimitedProcedure(ratelimit.create) permission.data, ]); const p = permissions[0]; - await db.transaction(async (tx) => { - await tx - .insert(schema.keysPermissions) - .values({ - keyId: rootKey.id, - permissionId: p.id, - workspaceId: p.workspaceId, - }) - .onDuplicateKeyUpdate({ set: { permissionId: p.id } }) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to add permission to the root key. Please contact support using support@unkey.dev.", + await db + .transaction(async (tx) => { + await tx + .insert(schema.keysPermissions) + .values({ + keyId: rootKey.id, + permissionId: p.id, + workspaceId: p.workspaceId, + }) + .onDuplicateKeyUpdate({ set: { permissionId: p.id } }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to add permission to the root key. Please contact support using support@unkey.dev.", + }); }); - }); - await insertAuditLogs(tx, [ - ...auditLogs, - { - workspaceId: workspace.id, - actor: { type: "user", id: ctx.user.id }, - event: "authorization.connect_permission_and_key", - description: `Attached ${p.id} to ${rootKey.id}`, - resources: [ - { - type: "key", - id: rootKey.id, - }, - { - type: "permission", - id: p.id, + await insertAuditLogs(tx, [ + ...auditLogs, + { + workspaceId: workspace.id, + actor: { type: "user", id: ctx.user.id }, + event: "authorization.connect_permission_and_key", + description: `Attached ${p.id} to ${rootKey.id}`, + resources: [ + { + type: "key", + id: rootKey.id, + }, + { + type: "permission", + id: p.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, }, - }, - ]); - }); + ]); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to add permission to the rootkey. Please contact support using support@unkey.dev", + }); + }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts b/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts index a291cb529f..132fb558f2 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts @@ -61,39 +61,47 @@ export const connectPermissionToRole = rateLimitedProcedure(ratelimit.update) permissionId: permission.id, roleId: role.id, }; - await db.transaction(async (tx) => { - await tx - .insert(schema.rolesPermissions) - .values({ ...tuple, createdAt: new Date() }) - .onDuplicateKeyUpdate({ - set: { ...tuple, updatedAt: new Date() }, - }) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to connect the permission to the role. Please contact support using support@unkey.dev.", + await db + .transaction(async (tx) => { + await tx + .insert(schema.rolesPermissions) + .values({ ...tuple, createdAt: new Date() }) + .onDuplicateKeyUpdate({ + set: { ...tuple, updatedAt: new Date() }, + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to connect the permission to the role. Please contact support using support@unkey.dev.", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: workspace.id, - actor: { type: "user", id: ctx.user.id }, - event: "authorization.connect_role_and_permission", - description: `Connect role ${role.id} to ${permission.id}`, - resources: [ - { - type: "role", - id: role.id, - }, - { - type: "permission", - id: permission.id, + await insertAuditLogs(tx, { + workspaceId: workspace.id, + actor: { type: "user", id: ctx.user.id }, + event: "authorization.connect_role_and_permission", + description: `Connect role ${role.id} to ${permission.id}`, + resources: [ + { + type: "role", + id: role.id, + }, + { + type: "permission", + id: permission.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to connect this permission to role. Please contact support using support@unkey.dev", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts b/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts index 2809667048..fc08d27e6d 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts @@ -61,39 +61,47 @@ export const connectRoleToKey = rateLimitedProcedure(ratelimit.update) keyId: key.id, roleId: role.id, }; - await db.transaction(async (tx) => { - await tx - .insert(schema.keysRoles) - .values({ ...tuple, createdAt: new Date() }) - .onDuplicateKeyUpdate({ - set: { ...tuple, updatedAt: new Date() }, - }) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to connect the role and key. Please contact support using support@unkey.dev.", + await db + .transaction(async (tx) => { + await tx + .insert(schema.keysRoles) + .values({ ...tuple, createdAt: new Date() }) + .onDuplicateKeyUpdate({ + set: { ...tuple, updatedAt: new Date() }, + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to connect the role and key. Please contact support using support@unkey.dev.", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: workspace.id, - actor: { type: "user", id: ctx.user.id }, - event: "authorization.connect_role_and_key", - description: `Connect role ${role.id} to ${key.id}`, - resources: [ - { - type: "role", - id: role.id, - }, - { - type: "key", - id: key.id, + await insertAuditLogs(tx, { + workspaceId: workspace.id, + actor: { type: "user", id: ctx.user.id }, + event: "authorization.connect_role_and_key", + description: `Connect role ${role.id} to ${key.id}`, + resources: [ + { + type: "role", + id: role.id, + }, + { + type: "key", + id: key.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to connect the role to the key. Please contact support using support@unkey.dev", + }); }); - }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts index af87eb79c3..af9cbfc3c1 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts @@ -77,6 +77,13 @@ export const createPermission = rateLimitedProcedure(ratelimit.create) message: "We are unable to create a permission. Please contact support using support@unkey.dev.", }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to create permission. Please contact support using support@unkey.dev", + }); }); return { permissionId }; diff --git a/apps/dashboard/lib/trpc/routers/rbac/createRole.ts b/apps/dashboard/lib/trpc/routers/rbac/createRole.ts index ba6a505438..c69eef9a2d 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/createRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/createRole.ts @@ -42,76 +42,83 @@ export const createRole = rateLimitedProcedure(ratelimit.create) }); } const roleId = newId("role"); - await db.transaction(async (tx) => { - await tx - .insert(schema.roles) - .values({ - id: roleId, - name: input.name, - description: input.description, - workspaceId: workspace.id, - }) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to create a role. Please contact support using support@unkey.dev.", - }); - }); - await insertAuditLogs(tx, { - workspaceId: workspace.id, - event: "role.create", - actor: { - type: "user", - id: ctx.user.id, - }, - description: `Created ${roleId}`, - resources: [ - { - type: "role", + await db + .transaction(async (tx) => { + await tx + .insert(schema.roles) + .values({ id: roleId, + name: input.name, + description: input.description, + workspaceId: workspace.id, + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to create a role. Please contact support using support@unkey.dev.", + }); + }); + await insertAuditLogs(tx, { + workspaceId: workspace.id, + event: "role.create", + actor: { + type: "user", + id: ctx.user.id, }, - ], + description: `Created ${roleId}`, + resources: [ + { + type: "role", + id: roleId, + }, + ], - context: { - userAgent: ctx.audit.userAgent, - location: ctx.audit.location, - }, - }); + context: { + userAgent: ctx.audit.userAgent, + location: ctx.audit.location, + }, + }); - if (input.permissionIds && input.permissionIds.length > 0) { - await tx.insert(schema.rolesPermissions).values( - input.permissionIds.map((permissionId) => ({ - permissionId, - roleId: roleId, - workspaceId: workspace.id, - })), - ); - await insertAuditLogs( - tx, - input.permissionIds.map((permissionId) => ({ - workspaceId: workspace.id, - event: "authorization.connect_role_and_permission", - actor: { - type: "user", - id: ctx.user.id, - }, - description: `Connected ${roleId} and ${permissionId}`, - resources: [ - { type: "role", id: roleId }, - { - type: "permission", - id: permissionId, + if (input.permissionIds && input.permissionIds.length > 0) { + await tx.insert(schema.rolesPermissions).values( + input.permissionIds.map((permissionId) => ({ + permissionId, + roleId: roleId, + workspaceId: workspace.id, + })), + ); + await insertAuditLogs( + tx, + input.permissionIds.map((permissionId) => ({ + workspaceId: workspace.id, + event: "authorization.connect_role_and_permission", + actor: { + type: "user", + id: ctx.user.id, }, - ], + description: `Connected ${roleId} and ${permissionId}`, + resources: [ + { type: "role", id: roleId }, + { + type: "permission", + id: permissionId, + }, + ], - context: { - userAgent: ctx.audit.userAgent, - location: ctx.audit.location, - }, - })), - ); - } - }); + context: { + userAgent: ctx.audit.userAgent, + location: ctx.audit.location, + }, + })), + ); + } + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: "We are unable to create role. Please contact support using support@unkey.dev", + }); + }); return { roleId }; }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts b/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts index b903ba1512..aed1f4299f 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts @@ -60,6 +60,12 @@ export async function upsertPermission( location: ctx.audit.location, userAgent: ctx.audit.userAgent, }, + }).catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to upsert the permission. Please contact support using support@unkey.dev", + }); }); return permission; diff --git a/apps/dashboard/lib/trpc/routers/workspace/changeName.ts b/apps/dashboard/lib/trpc/routers/workspace/changeName.ts index d42972fa60..31b94d3dbd 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/changeName.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/changeName.ts @@ -28,41 +28,49 @@ export const changeWorkspaceName = rateLimitedProcedure(ratelimit.update) if (!ws || ws.tenantId !== ctx.tenant.id) { throw new Error("Workspace not found, Please sign back in and try again"); } - await db.transaction(async (tx) => { - await tx - .update(schema.workspaces) - .set({ - name: input.name, - }) - .where(eq(schema.workspaces.id, input.workspaceId)) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to update the workspace name. Please contact support using support@unkey.dev", + await db + .transaction(async (tx) => { + await tx + .update(schema.workspaces) + .set({ + name: input.name, + }) + .where(eq(schema.workspaces.id, input.workspaceId)) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update the workspace name. Please contact support using support@unkey.dev", + }); }); - }); - await insertAuditLogs(tx, { - workspaceId: ws.id, - actor: { type: "user", id: ctx.user.id }, - event: "workspace.update", - description: `Changed name from ${ws.name} to ${input.name}`, - resources: [ - { - type: "workspace", - id: ws.id, + await insertAuditLogs(tx, { + workspaceId: ws.id, + actor: { type: "user", id: ctx.user.id }, + event: "workspace.update", + description: `Changed name from ${ws.name} to ${input.name}`, + resources: [ + { + type: "workspace", + id: ws.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, - }); + }); - if (ctx.tenant.id.startsWith("org_")) { - await clerkClient.organizations.updateOrganization(ctx.tenant.id, { - name: input.name, + if (ctx.tenant.id.startsWith("org_")) { + await clerkClient.organizations.updateOrganization(ctx.tenant.id, { + name: input.name, + }); + } + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to update the workspace name. Please contact support using support@unkey.dev", }); - } - }); + }); }); diff --git a/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts b/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts index 56ec6ccfd2..c00e4723be 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts @@ -160,33 +160,41 @@ export const changeWorkspacePlan = rateLimitedProcedure(ratelimit.update) message: "You do not have a payment method. Please add one before upgrading.", }); } - await db.transaction(async (tx) => { - await tx - .update(schema.workspaces) - .set({ - plan: "pro", - planChanged: new Date(), - subscriptions: defaultProSubscriptions(), - planDowngradeRequest: null, - }) - .where(eq(schema.workspaces.id, input.workspaceId)); - await insertAuditLogs(tx, { - workspaceId: workspace.id, - actor: { type: "user", id: ctx.user.id }, - event: "workspace.update", - description: "Changed plan to 'pro'", - resources: [ - { - type: "workspace", - id: workspace.id, + await db + .transaction(async (tx) => { + await tx + .update(schema.workspaces) + .set({ + plan: "pro", + planChanged: new Date(), + subscriptions: defaultProSubscriptions(), + planDowngradeRequest: null, + }) + .where(eq(schema.workspaces.id, input.workspaceId)); + await insertAuditLogs(tx, { + workspaceId: workspace.id, + actor: { type: "user", id: ctx.user.id }, + event: "workspace.update", + description: "Changed plan to 'pro'", + resources: [ + { + type: "workspace", + id: workspace.id, + }, + ], + context: { + location: ctx.audit.location, + userAgent: ctx.audit.userAgent, }, - ], - context: { - location: ctx.audit.location, - userAgent: ctx.audit.userAgent, - }, + }); + }) + .catch((_err) => { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: + "We are unable to change plans. Please contact support using support@unkey.dev", + }); }); - }); return { title: "Your workspace has been upgraded" }; } } From a1dd4d910e9f8489f917981c0adc030b9cd78ad8 Mon Sep 17 00:00:00 2001 From: Harsh Shrikant Bhat <90265455+harshsbhat@users.noreply.github.com> Date: Wed, 9 Oct 2024 20:03:41 +0530 Subject: [PATCH 2/4] chore: typo --- apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts | 2 +- .../dashboard/lib/trpc/routers/ratelimit/updateOverride.ts | 6 +++--- apps/dashboard/lib/trpc/routers/rbac/createPermission.ts | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts index d8f5bdfd25..600f682a8b 100644 --- a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts +++ b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts @@ -75,7 +75,7 @@ export const setDefaultApiBytes = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were update the default bytes. Please contact support using support@unkey.dev.", + "We were unable to update the default bytes. Please contact support using support@unkey.dev.", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts index 108509e4cf..8d7336a486 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts @@ -38,7 +38,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update this override for this namespae. Please contact support using support@unkey.dev", + "We are unable to update the override for this namespace. Please contact support using support@unkey.dev", }); }); @@ -64,7 +64,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) .catch((_err) => { throw new TRPCError({ message: - "We are unable to update the override. Please contact support using support@unkey.dev.", + "We are unable to update the override for this namespace. Please contact support using support@unkey.dev.", code: "INTERNAL_SERVER_ERROR", }); }); @@ -102,7 +102,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update this override for this namespae. Please contact support using support@unkey.dev", + "We are unable to update the override for this namespace. Please contact support using support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts index af9cbfc3c1..af87eb79c3 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts @@ -77,13 +77,6 @@ export const createPermission = rateLimitedProcedure(ratelimit.create) message: "We are unable to create a permission. Please contact support using support@unkey.dev.", }); - }) - .catch((_err) => { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to create permission. Please contact support using support@unkey.dev", - }); }); return { permissionId }; From 355616061796a64c08ed9bd69f675e3a23ead23e Mon Sep 17 00:00:00 2001 From: chronark Date: Thu, 10 Oct 2024 11:27:10 +0200 Subject: [PATCH 3/4] fix: error message --- apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts | 6 +++--- apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts | 7 +++---- .../lib/trpc/routers/api/updateDeleteProtection.ts | 4 ++-- apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts | 2 +- apps/dashboard/lib/trpc/routers/api/updateName.ts | 8 ++++---- apps/dashboard/lib/trpc/routers/key/create.ts | 6 +++--- apps/dashboard/lib/trpc/routers/key/createRootKey.ts | 6 +++--- apps/dashboard/lib/trpc/routers/key/delete.ts | 4 ++-- apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts | 4 ++-- apps/dashboard/lib/trpc/routers/key/updateEnabled.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateExpiration.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateMetadata.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateName.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateRemaining.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts | 4 ++-- apps/dashboard/lib/trpc/routers/llmGateway/create.ts | 2 +- apps/dashboard/lib/trpc/routers/llmGateway/delete.ts | 2 +- .../lib/trpc/routers/ratelimit/createNamespace.ts | 2 +- .../lib/trpc/routers/ratelimit/createOverride.ts | 2 +- .../lib/trpc/routers/ratelimit/deleteNamespace.ts | 2 +- .../lib/trpc/routers/ratelimit/deleteOverride.ts | 2 +- .../lib/trpc/routers/ratelimit/updateOverride.ts | 4 ++-- .../lib/trpc/routers/rbac/addPermissionToRootKey.ts | 6 +++--- .../lib/trpc/routers/rbac/connectPermissionToRole.ts | 8 ++++---- apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts | 8 ++++---- apps/dashboard/lib/trpc/routers/rbac/createPermission.ts | 4 ++-- apps/dashboard/lib/trpc/routers/rbac/createRole.ts | 4 ++-- apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts | 4 ++-- apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts | 6 +++--- .../lib/trpc/routers/rbac/disconnectPermissionFromRole.ts | 2 +- .../lib/trpc/routers/rbac/disconnectRoleFromKey.ts | 2 +- .../lib/trpc/routers/rbac/removePermissionFromRootKey.ts | 2 +- apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts | 6 +++--- apps/dashboard/lib/trpc/routers/rbac/updateRole.ts | 6 +++--- apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts | 2 +- apps/dashboard/lib/trpc/routers/workspace/changePlan.ts | 2 +- apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts | 4 ++-- 39 files changed, 73 insertions(+), 74 deletions(-) diff --git a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts index 600f682a8b..de72fcef1b 100644 --- a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts +++ b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts @@ -26,7 +26,7 @@ export const setDefaultApiBytes = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to find the KeyAuth. Please contact support using support@unkey.dev.", + "We were unable to find the KeyAuth. Please try again or contact support@unkey.dev.", }); }); if (!keyAuth || keyAuth.workspaceId !== input.workspaceId) { @@ -48,7 +48,7 @@ export const setDefaultApiBytes = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API default bytes. Please contact support using support@unkey.dev.", + "We were unable to update the API default bytes. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { @@ -75,7 +75,7 @@ export const setDefaultApiBytes = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the default bytes. Please contact support using support@unkey.dev.", + "We were unable to update the default bytes. Please try again or contact support@unkey.dev.", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts b/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts index 58f4640ae9..577e594279 100644 --- a/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts +++ b/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts @@ -21,8 +21,7 @@ export const setDefaultApiPrefix = rateLimitedProcedure(ratelimit.update) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: - "We were unable to find KeyAuth. Please contact support using support@unkey.dev.", + message: "We were unable to find KeyAuth. Please try again or contact support@unkey.dev.", }); }); if (!keyAuth || keyAuth.workspaceId !== input.workspaceId) { @@ -44,7 +43,7 @@ export const setDefaultApiPrefix = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API default prefix. Please contact support using support@unkey.dev.", + "We were unable to update the API default prefix. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { @@ -71,7 +70,7 @@ export const setDefaultApiPrefix = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the default prefix. Please contact support using support@unkey.dev.", + "We were unable to update the default prefix. Please try again or contact support@unkey.dev.", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts b/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts index 368f23aa60..12a88cb001 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts @@ -32,7 +32,7 @@ export const updateAPIDeleteProtection = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct API. Please contact support using support@unkey.dev.", + "We are unable to find the correct API. Please try again or contact support@unkey.dev.", }); } @@ -48,7 +48,7 @@ export const updateAPIDeleteProtection = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API. Please contact support using support@unkey.dev.", + "We were unable to update the API. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { diff --git a/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts b/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts index 513e6d7840..d37b34d553 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts @@ -47,7 +47,7 @@ export const updateApiIpWhitelist = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct API. Please contact support using support@unkey.dev.", + "We are unable to find the correct API. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/api/updateName.ts b/apps/dashboard/lib/trpc/routers/api/updateName.ts index f77153eed7..b11a28a47e 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateName.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateName.ts @@ -26,14 +26,14 @@ export const updateApiName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API name. Please contact support using support@unkey.dev.", + "We were unable to update the API name. Please try again or contact support@unkey.dev.", }); }); if (!api || api.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct API. Please contact support using support@unkey.dev.", + "We are unable to find the correct API. Please try again or contact support@unkey.dev.", }); } await db @@ -48,7 +48,7 @@ export const updateApiName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API name. Please contact support using support@unkey.dev.", + "We were unable to update the API name. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { @@ -75,7 +75,7 @@ export const updateApiName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API name. Please contact support using support@unkey.dev.", + "We were unable to update the API name. Please try again or contact support@unkey.dev.", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/create.ts b/apps/dashboard/lib/trpc/routers/key/create.ts index 0c7f9f5a2f..7ae018f2b8 100644 --- a/apps/dashboard/lib/trpc/routers/key/create.ts +++ b/apps/dashboard/lib/trpc/routers/key/create.ts @@ -44,14 +44,14 @@ export const createKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to create a key for this API. Please contact support using support@unkey.dev.", + "We were unable to create a key for this API. Please try again or contact support@unkey.dev.", }); }); if (!workspace) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } @@ -66,7 +66,7 @@ export const createKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to create a key for this API. Please contact support using support@unkey.dev.", + "We were unable to create a key for this API. Please try again or contact support@unkey.dev.", }); }); if (!keyAuth || keyAuth.workspaceId !== workspace.id) { diff --git a/apps/dashboard/lib/trpc/routers/key/createRootKey.ts b/apps/dashboard/lib/trpc/routers/key/createRootKey.ts index 6761ca577f..736b5ad267 100644 --- a/apps/dashboard/lib/trpc/routers/key/createRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/key/createRootKey.ts @@ -30,14 +30,14 @@ export const createRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to create a root key for this workspace. Please contact support using support@unkey.dev.", + "We were unable to create a root key for this workspace. Please try again or contact support@unkey.dev.", }); }); if (!workspace) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } @@ -52,7 +52,7 @@ export const createRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to create a rootkey for this workspace. Please contact support using support@unkey.dev.", + "We were unable to create a rootkey for this workspace. Please try again or contact support@unkey.dev.", }); }); if (!unkeyApi) { diff --git a/apps/dashboard/lib/trpc/routers/key/delete.ts b/apps/dashboard/lib/trpc/routers/key/delete.ts index 9b207328f7..f243258621 100644 --- a/apps/dashboard/lib/trpc/routers/key/delete.ts +++ b/apps/dashboard/lib/trpc/routers/key/delete.ts @@ -29,14 +29,14 @@ export const deleteKeys = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to delete this key. Please contact support using support@unkey.dev.", + "We were unable to delete this key. Please try again or contact support@unkey.dev.", }); }); if (!workspace) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts b/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts index 8e7d81a75d..5275a987ea 100644 --- a/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts @@ -21,7 +21,7 @@ export const deleteRootKeys = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to delete this root key. Please contact support using support@unkey.dev.", + "We were unable to delete this root key. Please try again or contact support@unkey.dev.", }); }); @@ -29,7 +29,7 @@ export const deleteRootKeys = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts b/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts index 328814a3b3..c83bd78fab 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts @@ -31,7 +31,7 @@ export const updateKeyEnabled = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the the correct key. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts b/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts index d46a138cca..56157f8c4a 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts @@ -51,7 +51,7 @@ export const updateKeyExpiration = rateLimitedProcedure(ratelimit.update) if (!key || key.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the the correct key. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts b/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts index 26aaecee00..b48bb252a8 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts @@ -44,7 +44,7 @@ export const updateKeyMetadata = rateLimitedProcedure(ratelimit.update) if (!key || key.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the correct key. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateName.ts b/apps/dashboard/lib/trpc/routers/key/updateName.ts index fed0f7634f..db34980d9b 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateName.ts @@ -32,7 +32,7 @@ export const updateKeyName = rateLimitedProcedure(ratelimit.update) if (!key || key.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the correct key. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts index 957bb7ae14..7e0942d9f4 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts @@ -30,7 +30,7 @@ export const updateKeyOwnerId = rateLimitedProcedure(ratelimit.update) if (!key || key.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the correct key. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts b/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts index 24583f4edb..86a389ac87 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts @@ -34,7 +34,7 @@ export const updateKeyRatelimit = rateLimitedProcedure(ratelimit.update) if (!key || key.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the correct key. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts b/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts index fdfdd249fd..d1a441da33 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts @@ -40,7 +40,7 @@ export const updateKeyRemaining = rateLimitedProcedure(ratelimit.update) if (!key || key.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the correct key. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts index a84b723d66..a7efe21844 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts @@ -35,14 +35,14 @@ export const updateRootKeyName = t.procedure throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } if (!key || key.forWorkspaceId !== workspace.id) { throw new TRPCError({ message: - "We are unable to find the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the correct key. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/llmGateway/create.ts b/apps/dashboard/lib/trpc/routers/llmGateway/create.ts index 01511d64e9..17c69ca861 100644 --- a/apps/dashboard/lib/trpc/routers/llmGateway/create.ts +++ b/apps/dashboard/lib/trpc/routers/llmGateway/create.ts @@ -29,7 +29,7 @@ export const createLlmGateway = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts b/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts index f9cf66c250..bc7083bfae 100644 --- a/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts +++ b/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts @@ -31,7 +31,7 @@ export const deleteLlmGateway = rateLimitedProcedure(ratelimit.delete) if (!llmGateway || llmGateway.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ code: "NOT_FOUND", - message: "LLM gateway not found. please contact support using support@unkey.dev.", + message: "LLM gateway not found. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts b/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts index d626aba585..bed81fb97d 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts @@ -30,7 +30,7 @@ export const createNamespace = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts index 021361c849..af76017ed2 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts @@ -42,7 +42,7 @@ export const createOverride = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct namespace. Please contact support using support@unkey.dev.", + "We are unable to find the correct namespace. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts b/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts index 2a0d8e15d9..10f36452e6 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts @@ -37,7 +37,7 @@ export const deleteNamespace = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct namespace. Please contact support using support@unkey.dev.", + "We are unable to find the correct namespace. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts index 70740587d9..437e5d3c67 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts @@ -42,7 +42,7 @@ export const deleteOverride = rateLimitedProcedure(ratelimit.create) if (!override || override.namespace.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct override. Please contact support using support@unkey.dev.", + "We are unable to find the correct override. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts index 8d7336a486..fcfac95572 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts @@ -45,7 +45,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) if (!override || override.namespace.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct override. Please contact support using support@unkey.dev.", + "We are unable to find the correct override. Please try again or contact support@unkey.dev.", code: "NOT_FOUND", }); } @@ -64,7 +64,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) .catch((_err) => { throw new TRPCError({ message: - "We are unable to update the override for this namespace. Please contact support using support@unkey.dev.", + "We are unable to update the override for this namespace. Please try again or contact support@unkey.dev.", code: "INTERNAL_SERVER_ERROR", }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts b/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts index 6e6f5b097b..eff9a237c0 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts @@ -38,7 +38,7 @@ export const addPermissionToRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } @@ -57,7 +57,7 @@ export const addPermissionToRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct root key. Please contact support using support@unkey.dev.", + "We are unable to find the correct root key. Please try again or contact support@unkey.dev.", }); } @@ -79,7 +79,7 @@ export const addPermissionToRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to add permission to the root key. Please contact support using support@unkey.dev.", + "We are unable to add permission to the root key. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, [ diff --git a/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts b/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts index 132fb558f2..f80bc1a564 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts @@ -36,7 +36,7 @@ export const connectPermissionToRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } const role = workspace.roles.at(0); @@ -44,7 +44,7 @@ export const connectPermissionToRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct role. Please contact support using support@unkey.dev.", + "We are unable to find the correct role. Please try again or contact support@unkey.dev.", }); } const permission = workspace.permissions.at(0); @@ -52,7 +52,7 @@ export const connectPermissionToRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct permission. Please contact support using support@unkey.dev.", + "We are unable to find the correct permission. Please try again or contact support@unkey.dev.", }); } @@ -73,7 +73,7 @@ export const connectPermissionToRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to connect the permission to the role. Please contact support using support@unkey.dev.", + "We are unable to connect the permission to the role. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { diff --git a/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts b/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts index fc08d27e6d..4d03eddde4 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts @@ -36,7 +36,7 @@ export const connectRoleToKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } const role = workspace.roles.at(0); @@ -44,7 +44,7 @@ export const connectRoleToKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct role. Please contact support using support@unkey.dev.", + "We are unable to find the correct role. Please try again or contact support@unkey.dev.", }); } const key = workspace.keys.at(0); @@ -52,7 +52,7 @@ export const connectRoleToKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct key. Please contact support using support@unkey.dev.", + "We are unable to find the correct key. Please try again or contact support@unkey.dev.", }); } @@ -73,7 +73,7 @@ export const connectRoleToKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to connect the role and key. Please contact support using support@unkey.dev.", + "We are unable to connect the role and key. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { diff --git a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts index af87eb79c3..5c329fb860 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts @@ -38,7 +38,7 @@ export const createPermission = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } const permissionId = newId("permission"); @@ -75,7 +75,7 @@ export const createPermission = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create a permission. Please contact support using support@unkey.dev.", + "We are unable to create a permission. Please try again or contact support@unkey.dev.", }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/createRole.ts b/apps/dashboard/lib/trpc/routers/rbac/createRole.ts index c69eef9a2d..8daa9aa389 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/createRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/createRole.ts @@ -38,7 +38,7 @@ export const createRole = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } const roleId = newId("role"); @@ -56,7 +56,7 @@ export const createRole = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create a role. Please contact support using support@unkey.dev.", + "We are unable to create a role. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { diff --git a/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts b/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts index a7fa53ebff..246e75fe14 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts @@ -33,14 +33,14 @@ export const deletePermission = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } if (workspace.permissions.length === 0) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct permission. Please contact support using support@unkey.dev.", + "We are unable to find the correct permission. Please try again or contact support@unkey.dev.", }); } await db diff --git a/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts b/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts index 2d93b984eb..bd5ef9b42e 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts @@ -32,14 +32,14 @@ export const deleteRole = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } if (workspace.roles.length === 0) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct role. Please contact support using support@unkey.dev.", + "We are unable to find the correct role. Please try again or contact support@unkey.dev.", }); } await db.transaction(async (tx) => { @@ -73,7 +73,7 @@ export const deleteRole = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete the role. Please contact support using support@unkey.dev.", + "We are unable to delete the role. Please try again or contact support@unkey.dev.", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts b/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts index 1b130b8e06..d63930265d 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts @@ -28,7 +28,7 @@ export const disconnectPermissionFromRole = rateLimitedProcedure(ratelimit.updat throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } await db diff --git a/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts b/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts index 48caddfb40..31b93aacb9 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts @@ -28,7 +28,7 @@ export const disconnectRoleFromKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } await db diff --git a/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts b/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts index 511717e1c3..08be3644eb 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts @@ -29,7 +29,7 @@ export const removePermissionFromRootKey = rateLimitedProcedure(ratelimit.update throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } diff --git a/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts b/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts index a0b84d3150..06fd731edc 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts @@ -43,14 +43,14 @@ export const updatePermission = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } if (workspace.permissions.length === 0) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct permission. Please contact support using support@unkey.dev.", + "We are unable to find the correct permission. Please try again or contact support@unkey.dev.", }); } @@ -87,7 +87,7 @@ export const updatePermission = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the permission. Please contact support using support@unkey.dev.", + "We are unable to update the permission. Please try again or contact support@unkey.dev.", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts b/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts index d09d9a3067..ceb4e4afa9 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts @@ -44,14 +44,14 @@ export const updateRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev.", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev.", }); } if (workspace.roles.length === 0) { throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct role. Please contact support using support@unkey.dev.", + "We are unable to find the correct role. Please try again or contact support@unkey.dev.", }); } await db @@ -79,7 +79,7 @@ export const updateRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the role. Please contact support using support@unkey.dev.", + "We are unable to update the role. Please try again or contact support@unkey.dev.", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts b/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts index aed1f4299f..d57ea9fa23 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts @@ -42,7 +42,7 @@ export async function upsertPermission( throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to upsert the permission. Please contact support using support@unkey.dev.", + "We are unable to upsert the permission. Please try again or contact support@unkey.dev.", }); }); await insertAuditLogs(tx, { diff --git a/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts b/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts index c00e4723be..ec3228e018 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts @@ -41,7 +41,7 @@ export const changeWorkspacePlan = rateLimitedProcedure(ratelimit.update) if (!workspace) { throw new TRPCError({ code: "NOT_FOUND", - message: "Workspace not found, please contact support using support@unkey.dev.", + message: "Workspace not found, Please try again or contact support@unkey.dev.", }); } if (workspace.tenantId !== ctx.tenant.id) { diff --git a/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts b/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts index e0d93cb5e4..c217d2e540 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts @@ -27,7 +27,7 @@ export const optWorkspaceIntoBeta = rateLimitedProcedure(ratelimit.update) if (!workspace) { throw new TRPCError({ code: "NOT_FOUND", - message: "Workspace not found, please contact support using support@unkey.dev.", + message: "Workspace not found, Please try again or contact support@unkey.dev.", }); } @@ -74,7 +74,7 @@ export const optWorkspaceIntoBeta = rateLimitedProcedure(ratelimit.update) console.error(err); throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Failed to update workspace, please contact support using support@unkey.dev.", + message: "Failed to update workspace, Please try again or contact support@unkey.dev.", }); }); }); From 5537eca8320fe935fe4f0453658903f228d7bc2f Mon Sep 17 00:00:00 2001 From: chronark Date: Thu, 10 Oct 2024 11:30:40 +0200 Subject: [PATCH 4/4] fix: error message --- apps/dashboard/lib/trpc/routers/api/create.ts | 9 ++++----- apps/dashboard/lib/trpc/routers/api/delete.ts | 6 +++--- apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts | 2 +- .../dashboard/lib/trpc/routers/api/setDefaultPrefix.ts | 2 +- .../lib/trpc/routers/api/updateDeleteProtection.ts | 4 ++-- .../lib/trpc/routers/api/updateIpWhitelist.ts | 6 +++--- apps/dashboard/lib/trpc/routers/key/create.ts | 2 +- apps/dashboard/lib/trpc/routers/key/createRootKey.ts | 2 +- apps/dashboard/lib/trpc/routers/key/delete.ts | 3 +-- apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts | 2 +- apps/dashboard/lib/trpc/routers/key/updateEnabled.ts | 6 +++--- .../dashboard/lib/trpc/routers/key/updateExpiration.ts | 6 +++--- apps/dashboard/lib/trpc/routers/key/updateMetadata.ts | 6 +++--- apps/dashboard/lib/trpc/routers/key/updateName.ts | 6 +++--- apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts | 6 +++--- apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts | 4 ++-- apps/dashboard/lib/trpc/routers/key/updateRemaining.ts | 4 ++-- .../lib/trpc/routers/key/updateRootKeyName.ts | 6 +++--- apps/dashboard/lib/trpc/routers/llmGateway/create.ts | 2 +- apps/dashboard/lib/trpc/routers/llmGateway/delete.ts | 6 +++--- .../lib/trpc/routers/ratelimit/createNamespace.ts | 4 ++-- .../lib/trpc/routers/ratelimit/createOverride.ts | 4 ++-- .../lib/trpc/routers/ratelimit/deleteNamespace.ts | 6 +++--- .../lib/trpc/routers/ratelimit/deleteOverride.ts | 6 +++--- .../lib/trpc/routers/ratelimit/updateNamespaceName.ts | 10 +++++----- .../lib/trpc/routers/ratelimit/updateOverride.ts | 6 +++--- .../lib/trpc/routers/rbac/addPermissionToRootKey.ts | 4 ++-- .../lib/trpc/routers/rbac/connectPermissionToRole.ts | 4 ++-- .../lib/trpc/routers/rbac/connectRoleToKey.ts | 4 ++-- .../lib/trpc/routers/rbac/createPermission.ts | 2 +- apps/dashboard/lib/trpc/routers/rbac/createRole.ts | 4 ++-- .../lib/trpc/routers/rbac/deletePermission.ts | 4 ++-- apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts | 4 ++-- .../trpc/routers/rbac/disconnectPermissionFromRole.ts | 4 ++-- .../lib/trpc/routers/rbac/disconnectRoleFromKey.ts | 4 ++-- .../trpc/routers/rbac/removePermissionFromRootKey.ts | 4 ++-- .../lib/trpc/routers/rbac/updatePermission.ts | 2 +- apps/dashboard/lib/trpc/routers/rbac/updateRole.ts | 2 +- .../lib/trpc/routers/rbac/upsertPermission.ts | 4 ++-- .../dashboard/lib/trpc/routers/workspace/changeName.ts | 6 +++--- .../dashboard/lib/trpc/routers/workspace/changePlan.ts | 6 +++--- apps/dashboard/lib/trpc/routers/workspace/create.ts | 2 +- .../lib/trpc/routers/workspace/optIntoBeta.ts | 2 +- 43 files changed, 93 insertions(+), 95 deletions(-) diff --git a/apps/dashboard/lib/trpc/routers/api/create.ts b/apps/dashboard/lib/trpc/routers/api/create.ts index 04e109f0fb..e9ced2eba4 100644 --- a/apps/dashboard/lib/trpc/routers/api/create.ts +++ b/apps/dashboard/lib/trpc/routers/api/create.ts @@ -24,7 +24,7 @@ export const createApi = rateLimitedProcedure(ratelimit.create) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "We are unable to create an API. Please contact support using support@unkey.dev", + message: "We are unable to create an API. Please try again or contact support@unkey.dev", }); }); if (!ws) { @@ -44,7 +44,7 @@ export const createApi = rateLimitedProcedure(ratelimit.create) } catch (_err) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "We are unable to create an API. Please contact support using support@unkey.dev", + message: "We are unable to create an API. Please try again or contact support@unkey.dev", }); } @@ -67,7 +67,7 @@ export const createApi = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create the API. Please contact support using support@unkey.dev", + "We are unable to create the API. Please try again or contact support@unkey.dev", }); }); @@ -94,8 +94,7 @@ export const createApi = rateLimitedProcedure(ratelimit.create) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to create the API. Please contact support using support@unkey.dev", + message: "We are unable to create the API. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/delete.ts b/apps/dashboard/lib/trpc/routers/api/delete.ts index 087e3531dc..fc445f23b4 100644 --- a/apps/dashboard/lib/trpc/routers/api/delete.ts +++ b/apps/dashboard/lib/trpc/routers/api/delete.ts @@ -24,13 +24,13 @@ export const deleteApi = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete this API. Please contact support using support@unkey.dev", + "We are unable to delete this API. Please try again or contact support@unkey.dev", }); }); if (!api || api.workspace.tenantId !== ctx.tenant.id) { throw new TRPCError({ code: "NOT_FOUND", - message: "The API does not exist. Please contact support using support@unkey.dev", + message: "The API does not exist. Please try again or contact support@unkey.dev", }); } if (api.deleteProtection) { @@ -107,7 +107,7 @@ export const deleteApi = rateLimitedProcedure(ratelimit.delete) } catch (_err) { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "We are unable to delete the API. Please contact support using support@unkey.dev", + message: "We are unable to delete the API. Please try again or contact support@unkey.dev", }); } }); diff --git a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts index de72fcef1b..4e45f064b2 100644 --- a/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts +++ b/apps/dashboard/lib/trpc/routers/api/setDefaultBytes.ts @@ -33,7 +33,7 @@ export const setDefaultApiBytes = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct keyAuth. Please contact support using support@unkey.dev", + "We are unable to find the correct keyAuth. Please try again or contact support@unkey.dev", }); } await db diff --git a/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts b/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts index 577e594279..1d3ec5681c 100644 --- a/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts +++ b/apps/dashboard/lib/trpc/routers/api/setDefaultPrefix.ts @@ -28,7 +28,7 @@ export const setDefaultApiPrefix = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct keyAuth. Please contact support using support@unkey.dev", + "We are unable to find the correct keyAuth. Please try again or contact support@unkey.dev", }); } await db diff --git a/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts b/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts index 12a88cb001..c6cdf3fca9 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateDeleteProtection.ts @@ -25,7 +25,7 @@ export const updateAPIDeleteProtection = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API. Please contact support using support@unkey.dev", + "We were unable to update the API. Please try again or contact support@unkey.dev", }); }); if (!api || api.workspace.tenantId !== ctx.tenant.id) { @@ -80,7 +80,7 @@ export const updateAPIDeleteProtection = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the API. Please contact support using support@unkey.dev", + "We were unable to update the API. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts b/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts index d37b34d553..67954331c0 100644 --- a/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts +++ b/apps/dashboard/lib/trpc/routers/api/updateIpWhitelist.ts @@ -40,7 +40,7 @@ export const updateApiIpWhitelist = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the API whitelist. Please contact support using support@unkey.dev", + "We are unable to update the API whitelist. Please try again or contact support@unkey.dev", }); }); if (!api || api.workspace.tenantId !== ctx.tenant.id) { @@ -65,7 +65,7 @@ export const updateApiIpWhitelist = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the API whitelist. Please contact support using support@unkey.dev", + "We are unable to update the API whitelist. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -92,7 +92,7 @@ export const updateApiIpWhitelist = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the API whitelist. Please contact support using support@unkey.dev", + "We are unable to update the API whitelist. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/create.ts b/apps/dashboard/lib/trpc/routers/key/create.ts index 7ae018f2b8..46f2b0e6fc 100644 --- a/apps/dashboard/lib/trpc/routers/key/create.ts +++ b/apps/dashboard/lib/trpc/routers/key/create.ts @@ -73,7 +73,7 @@ export const createKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "NOT_FOUND", message: - "We are unable to find the correct keyAuth. Please contact support using support@unkey.dev", + "We are unable to find the correct keyAuth. Please try again or contact support@unkey.dev", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/createRootKey.ts b/apps/dashboard/lib/trpc/routers/key/createRootKey.ts index 736b5ad267..c78fafd35c 100644 --- a/apps/dashboard/lib/trpc/routers/key/createRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/key/createRootKey.ts @@ -193,7 +193,7 @@ export const createRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create the rootkey. Please contact support using support@unkey.dev", + "We are unable to create the rootkey. Please try again or contact support@unkey.dev", }); } diff --git a/apps/dashboard/lib/trpc/routers/key/delete.ts b/apps/dashboard/lib/trpc/routers/key/delete.ts index f243258621..8624762c77 100644 --- a/apps/dashboard/lib/trpc/routers/key/delete.ts +++ b/apps/dashboard/lib/trpc/routers/key/delete.ts @@ -77,8 +77,7 @@ export const deleteKeys = rateLimitedProcedure(ratelimit.delete) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: - "We are unable to delete the key. Please contact support using support@unkey.dev", + message: "We are unable to delete the key. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts b/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts index 5275a987ea..980a46d80f 100644 --- a/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/key/deleteRootKey.ts @@ -80,7 +80,7 @@ export const deleteRootKeys = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete the root key. Please contact support using support@unkey.dev", + "We are unable to delete the root key. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts b/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts index c83bd78fab..bc5e4d5322 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateEnabled.ts @@ -24,7 +24,7 @@ export const updateKeyEnabled = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update enabled on this key. Please contact support using support@unkey.dev", + "We were unable to update enabled on this key. Please try again or contact support@unkey.dev", }); }); if (!key || key.workspace.tenantId !== ctx.tenant.id) { @@ -47,7 +47,7 @@ export const updateKeyEnabled = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update enabled on this key. Please contact support using support@unkey.dev", + "We were unable to update enabled on this key. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -74,7 +74,7 @@ export const updateKeyEnabled = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update enabled on this key. Please contact support using support@unkey.dev", + "We were unable to update enabled on this key. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts b/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts index 56157f8c4a..c40cd8d380 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateExpiration.ts @@ -45,7 +45,7 @@ export const updateKeyExpiration = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update expiration on this key. Please contact support using support@unkey.dev", + "We were unable to update expiration on this key. Please try again or contact support@unkey.dev", }); }); if (!key || key.workspace.tenantId !== ctx.tenant.id) { @@ -67,7 +67,7 @@ export const updateKeyExpiration = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update expiration on this key. Please contact support using support@unkey.dev", + "We were unable to update expiration on this key. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -98,7 +98,7 @@ export const updateKeyExpiration = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update expiration on this key. Please contact support using support@unkey.dev", + "We were unable to update expiration on this key. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts b/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts index b48bb252a8..28fe176d3e 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateMetadata.ts @@ -38,7 +38,7 @@ export const updateKeyMetadata = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update metadata on this key. Please contact support using support@unkey.dev", + "We were unable to update metadata on this key. Please try again or contact support@unkey.dev", }); }); if (!key || key.workspace.tenantId !== ctx.tenant.id) { @@ -60,7 +60,7 @@ export const updateKeyMetadata = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update metadata on this key. Please contact support using support@unkey.dev", + "We are unable to update metadata on this key. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -87,7 +87,7 @@ export const updateKeyMetadata = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update metadata on this key. Please contact support using support@unkey.dev", + "We are unable to update metadata on this key. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateName.ts b/apps/dashboard/lib/trpc/routers/key/updateName.ts index db34980d9b..a072e5cdc5 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateName.ts @@ -26,7 +26,7 @@ export const updateKeyName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update the name on this key. Please contact support using support@unkey.dev", + "We were unable to update the name on this key. Please try again or contact support@unkey.dev", }); }); if (!key || key.workspace.tenantId !== ctx.tenant.id) { @@ -48,7 +48,7 @@ export const updateKeyName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update name on this key. Please contact support using support@unkey.dev", + "We are unable to update name on this key. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -75,7 +75,7 @@ export const updateKeyName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update name on this key. Please contact support using support@unkey.dev", + "We are unable to update name on this key. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts index 7e0942d9f4..4b32a0a1d5 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts @@ -24,7 +24,7 @@ export const updateKeyOwnerId = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update ownerId on this key. Please contact support using support@unkey.dev", + "We were unable to update ownerId on this key. Please try again or contact support@unkey.dev", }); }); if (!key || key.workspace.tenantId !== ctx.tenant.id) { @@ -47,7 +47,7 @@ export const updateKeyOwnerId = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update ownerId on this key. Please contact support using support@unkey.dev", + "We were unable to update ownerId on this key. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -74,7 +74,7 @@ export const updateKeyOwnerId = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update ownerId on this key. Please contact support using support@unkey.dev", + "We were unable to update ownerId on this key. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts b/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts index 86a389ac87..7d64654ea6 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRatelimit.ts @@ -28,7 +28,7 @@ export const updateKeyRatelimit = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update ratelimits on this key. Please contact support using support@unkey.dev", + "We were unable to update ratelimits on this key. Please try again or contact support@unkey.dev", }); }); if (!key || key.workspace.tenantId !== ctx.tenant.id) { @@ -122,7 +122,7 @@ export const updateKeyRatelimit = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update ratelimit on this key. Please contact support using support@unkey.dev", + "We were unable to update ratelimit on this key. Please try again or contact support@unkey.dev", }); }); } diff --git a/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts b/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts index d1a441da33..4e04452366 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRemaining.ts @@ -60,7 +60,7 @@ export const updateKeyRemaining = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update remaining on this key. Please contact support using support@unkey.dev", + "We were unable to update remaining on this key. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -92,7 +92,7 @@ export const updateKeyRemaining = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update remaining limits on this key. Please contact support using support@unkey.dev", + "We were unable to update remaining limits on this key. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts index a7efe21844..c78586f7c5 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts @@ -27,7 +27,7 @@ export const updateRootKeyName = t.procedure throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to update root key name. Please contact support using support@unkey.dev", + "We were unable to update root key name. Please try again or contact support@unkey.dev", }); }); @@ -59,7 +59,7 @@ export const updateRootKeyName = t.procedure throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update root key name. Please contact support using support@unkey.dev", + "We are unable to update root key name. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -86,7 +86,7 @@ export const updateRootKeyName = t.procedure throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update root key name. Please contact support using support@unkey.dev", + "We are unable to update root key name. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/llmGateway/create.ts b/apps/dashboard/lib/trpc/routers/llmGateway/create.ts index 17c69ca861..a50a08562c 100644 --- a/apps/dashboard/lib/trpc/routers/llmGateway/create.ts +++ b/apps/dashboard/lib/trpc/routers/llmGateway/create.ts @@ -22,7 +22,7 @@ export const createLlmGateway = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We were unable to create LLM gateway. Please contact support using support@unkey.dev", + "We were unable to create LLM gateway. Please try again or contact support@unkey.dev", }); }); if (!ws) { diff --git a/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts b/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts index bc7083bfae..a031dbb4ff 100644 --- a/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts +++ b/apps/dashboard/lib/trpc/routers/llmGateway/delete.ts @@ -24,7 +24,7 @@ export const deleteLlmGateway = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete LLM gateway. Please contact support using support@unkey.dev", + "We are unable to delete LLM gateway. Please try again or contact support@unkey.dev", }); }); @@ -44,7 +44,7 @@ export const deleteLlmGateway = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete the LLM gateway. Please contact support using support@unkey.dev", + "We are unable to delete the LLM gateway. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -71,7 +71,7 @@ export const deleteLlmGateway = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete LLM gateway. Please contact support using support@unkey.dev", + "We are unable to delete LLM gateway. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts b/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts index bed81fb97d..b8f03e5369 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/createNamespace.ts @@ -23,7 +23,7 @@ export const createNamespace = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create a new namespace. Please contact support using support@unkey.dev", + "We are unable to create a new namespace. Please try again or contact support@unkey.dev", }); }); if (!ws) { @@ -74,7 +74,7 @@ export const createNamespace = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create namspace. Please contact support using support@unkey.dev", + "We are unable to create namspace. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts index af76017ed2..35332ad322 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/createOverride.ts @@ -35,7 +35,7 @@ export const createOverride = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create an override for this namespace. Please contact support using support@unkey.dev", + "We are unable to create an override for this namespace. Please try again or contact support@unkey.dev", }); }); if (!namespace || namespace.workspace.tenantId !== ctx.tenant.id) { @@ -108,7 +108,7 @@ export const createOverride = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create the override. Please contact support using support@unkey.dev", + "We are unable to create the override. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts b/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts index 10f36452e6..352dd4bd77 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/deleteNamespace.ts @@ -30,7 +30,7 @@ export const deleteNamespace = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete namespace. Please contact support using support@unkey.dev", + "We are unable to delete namespace. Please try again or contact support@unkey.dev", }); }); if (!namespace || namespace.workspace.tenantId !== ctx.tenant.id) { @@ -81,7 +81,7 @@ export const deleteNamespace = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete the namespaces. Please contact support using support@unkey.dev", + "We are unable to delete the namespaces. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs( @@ -113,7 +113,7 @@ export const deleteNamespace = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete the namespaces. Please contact support using support@unkey.dev", + "We are unable to delete the namespaces. Please try again or contact support@unkey.dev", }); }); } diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts index 437e5d3c67..1cbd3bb713 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/deleteOverride.ts @@ -35,7 +35,7 @@ export const deleteOverride = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete override for this namespace. Please contact support using support@unkey.dev", + "We are unable to delete override for this namespace. Please try again or contact support@unkey.dev", }); }); @@ -55,7 +55,7 @@ export const deleteOverride = rateLimitedProcedure(ratelimit.create) .catch((_err) => { throw new TRPCError({ message: - "We are unable to delete the override. Please contact support using support@unkey.dev", + "We are unable to delete the override. Please try again or contact support@unkey.dev", code: "INTERNAL_SERVER_ERROR", }); }); @@ -84,7 +84,7 @@ export const deleteOverride = rateLimitedProcedure(ratelimit.create) }).catch((_err) => { throw new TRPCError({ message: - "We are unable to delete the override. Please contact support using support@unkey.dev", + "We are unable to delete the override. Please try again or contact support@unkey.dev", code: "INTERNAL_SERVER_ERROR", }); }); diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/updateNamespaceName.ts b/apps/dashboard/lib/trpc/routers/ratelimit/updateNamespaceName.ts index c0ebf77418..91ea8e5242 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/updateNamespaceName.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/updateNamespaceName.ts @@ -29,14 +29,14 @@ export const updateNamespaceName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the name for this namespace. Please contact support using support@unkey.dev", + "We are unable to update the name for this namespace. Please try again or contact support@unkey.dev", }); }); if (!ws || ws.tenantId !== ctx.tenant.id) { throw new TRPCError({ message: - "We are unable to find the correct workspace. Please contact support using support@unkey.dev", + "We are unable to find the correct workspace. Please try again or contact support@unkey.dev", code: "NOT_FOUND", }); } @@ -44,7 +44,7 @@ export const updateNamespaceName = rateLimitedProcedure(ratelimit.update) if (!namespace) { throw new TRPCError({ message: - "We are unable to find the correct namespace. Please contact support using support@unkey.dev", + "We are unable to find the correct namespace. Please try again or contact support@unkey.dev", code: "NOT_FOUND", }); } @@ -59,7 +59,7 @@ export const updateNamespaceName = rateLimitedProcedure(ratelimit.update) .catch((_err) => { throw new TRPCError({ message: - "We are unable to update the namespace name. Please contact support using support@unkey.dev", + "We are unable to update the namespace name. Please try again or contact support@unkey.dev", code: "INTERNAL_SERVER_ERROR", }); }); @@ -84,7 +84,7 @@ export const updateNamespaceName = rateLimitedProcedure(ratelimit.update) }).catch((_err) => { throw new TRPCError({ message: - "We are unable to update the namespace name. Please contact support using support@unkey.dev", + "We are unable to update the namespace name. Please try again or contact support@unkey.dev", code: "INTERNAL_SERVER_ERROR", }); }); diff --git a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts index fcfac95572..6971ffdc3b 100644 --- a/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts +++ b/apps/dashboard/lib/trpc/routers/ratelimit/updateOverride.ts @@ -38,7 +38,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the override for this namespace. Please contact support using support@unkey.dev", + "We are unable to update the override for this namespace. Please try again or contact support@unkey.dev", }); }); @@ -94,7 +94,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the override. Please contact support using support@unkey.dev", + "We are unable to update the override. Please try again or contact support@unkey.dev", }); }); }) @@ -102,7 +102,7 @@ export const updateOverride = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the override for this namespace. Please contact support using support@unkey.dev", + "We are unable to update the override for this namespace. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts b/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts index eff9a237c0..64749a0c94 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/addPermissionToRootKey.ts @@ -31,7 +31,7 @@ export const addPermissionToRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to add permission to the rootkey. Please contact support using support@unkey.dev", + "We are unable to add permission to the rootkey. Please try again or contact support@unkey.dev", }); }); if (!workspace) { @@ -110,7 +110,7 @@ export const addPermissionToRootKey = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to add permission to the rootkey. Please contact support using support@unkey.dev", + "We are unable to add permission to the rootkey. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts b/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts index f80bc1a564..10897edaa4 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/connectPermissionToRole.ts @@ -29,7 +29,7 @@ export const connectPermissionToRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to connect this permission to role. Please contact support using support@unkey.dev", + "We are unable to connect this permission to role. Please try again or contact support@unkey.dev", }); }); if (!workspace) { @@ -101,7 +101,7 @@ export const connectPermissionToRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to connect this permission to role. Please contact support using support@unkey.dev", + "We are unable to connect this permission to role. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts b/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts index 4d03eddde4..96ae10d5c9 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/connectRoleToKey.ts @@ -29,7 +29,7 @@ export const connectRoleToKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to connect the role to the key. Please contact support using support@unkey.dev", + "We are unable to connect the role to the key. Please try again or contact support@unkey.dev", }); }); if (!workspace) { @@ -101,7 +101,7 @@ export const connectRoleToKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to connect the role to the key. Please contact support using support@unkey.dev", + "We are unable to connect the role to the key. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts index 5c329fb860..86095b75f2 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/createPermission.ts @@ -30,7 +30,7 @@ export const createPermission = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create permission. Please contact support using support@unkey.dev", + "We are unable to create permission. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/createRole.ts b/apps/dashboard/lib/trpc/routers/rbac/createRole.ts index 8daa9aa389..1ece2a4562 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/createRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/createRole.ts @@ -30,7 +30,7 @@ export const createRole = rateLimitedProcedure(ratelimit.create) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "We are unable to create role. Please contact support using support@unkey.dev", + message: "We are unable to create role. Please try again or contact support@unkey.dev", }); }); @@ -117,7 +117,7 @@ export const createRole = rateLimitedProcedure(ratelimit.create) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "We are unable to create role. Please contact support using support@unkey.dev", + message: "We are unable to create role. Please try again or contact support@unkey.dev", }); }); return { roleId }; diff --git a/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts b/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts index 246e75fe14..0558bac556 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/deletePermission.ts @@ -25,7 +25,7 @@ export const deletePermission = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete this permission. Please contact support using support@unkey.dev", + "We are unable to delete this permission. Please try again or contact support@unkey.dev", }); }); @@ -75,7 +75,7 @@ export const deletePermission = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete the permission. Please contact support using support@unkey.dev", + "We are unable to delete the permission. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts b/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts index bd5ef9b42e..a0eb9d27c4 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/deleteRole.ts @@ -24,7 +24,7 @@ export const deleteRole = rateLimitedProcedure(ratelimit.delete) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "We are unable to delete role. Please contact support using support@unkey.dev", + message: "We are unable to delete role. Please try again or contact support@unkey.dev", }); }); @@ -50,7 +50,7 @@ export const deleteRole = rateLimitedProcedure(ratelimit.delete) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to delete the role. Please contact support using support@unkey.dev", + "We are unable to delete the role. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { diff --git a/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts b/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts index d63930265d..97fd27f57b 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/disconnectPermissionFromRole.ts @@ -21,7 +21,7 @@ export const disconnectPermissionFromRole = rateLimitedProcedure(ratelimit.updat throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to remove permission from the role. Please contact support using support@unkey.dev", + "We are unable to remove permission from the role. Please try again or contact support@unkey.dev", }); }); if (!workspace) { @@ -68,7 +68,7 @@ export const disconnectPermissionFromRole = rateLimitedProcedure(ratelimit.updat throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to disconnect the permission from the role. Please contact support using support@unkey.dev", + "We are unable to disconnect the permission from the role. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts b/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts index 31b93aacb9..bfa719b850 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/disconnectRoleFromKey.ts @@ -21,7 +21,7 @@ export const disconnectRoleFromKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to disconnect the role from the key. Please contact support using support@unkey.dev", + "We are unable to disconnect the role from the key. Please try again or contact support@unkey.dev", }); }); if (!workspace) { @@ -68,7 +68,7 @@ export const disconnectRoleFromKey = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to disconnect the role from the key. Please contact support using support@unkey.dev", + "We are unable to disconnect the role from the key. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts b/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts index 08be3644eb..51ac33d6ce 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/removePermissionFromRootKey.ts @@ -21,7 +21,7 @@ export const removePermissionFromRootKey = rateLimitedProcedure(ratelimit.update throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to remove permission from the root key. Please contact support using support@unkey.dev", + "We are unable to remove permission from the root key. Please try again or contact support@unkey.dev", }); }); @@ -103,7 +103,7 @@ export const removePermissionFromRootKey = rateLimitedProcedure(ratelimit.update throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to remove permission from the root key. Please contact support using support@unkey.dev", + "We are unable to remove permission from the root key. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts b/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts index 06fd731edc..833bdfc643 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/updatePermission.ts @@ -35,7 +35,7 @@ export const updatePermission = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update permission. Please contact support using support@unkey.dev", + "We are unable to update permission. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts b/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts index ceb4e4afa9..1f1af9b63b 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/updateRole.ts @@ -36,7 +36,7 @@ export const updateRole = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the role. Please contact support using support@unkey.dev", + "We are unable to update the role. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts b/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts index d57ea9fa23..fdd06c02a5 100644 --- a/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts +++ b/apps/dashboard/lib/trpc/routers/rbac/upsertPermission.ts @@ -19,7 +19,7 @@ export async function upsertPermission( throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to upsert the permission. Please contact support using support@unkey.dev", + "We are unable to upsert the permission. Please try again or contact support@unkey.dev", }); }); if (existingPermission) { @@ -64,7 +64,7 @@ export async function upsertPermission( throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to upsert the permission. Please contact support using support@unkey.dev", + "We are unable to upsert the permission. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/workspace/changeName.ts b/apps/dashboard/lib/trpc/routers/workspace/changeName.ts index 31b94d3dbd..78cbc4bdb9 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/changeName.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/changeName.ts @@ -22,7 +22,7 @@ export const changeWorkspaceName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the workspace name. Please contact support using support@unkey.dev", + "We are unable to update the workspace name. Please try again or contact support@unkey.dev", }); }); if (!ws || ws.tenantId !== ctx.tenant.id) { @@ -40,7 +40,7 @@ export const changeWorkspaceName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the workspace name. Please contact support using support@unkey.dev", + "We are unable to update the workspace name. Please try again or contact support@unkey.dev", }); }); await insertAuditLogs(tx, { @@ -70,7 +70,7 @@ export const changeWorkspaceName = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to update the workspace name. Please contact support using support@unkey.dev", + "We are unable to update the workspace name. Please try again or contact support@unkey.dev", }); }); }); diff --git a/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts b/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts index ec3228e018..253c7f4f18 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/changePlan.ts @@ -34,7 +34,7 @@ export const changeWorkspacePlan = rateLimitedProcedure(ratelimit.update) .catch((_err) => { throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "We are unable to change plans. Please contact support using support@unkey.dev", + message: "We are unable to change plans. Please try again or contact support@unkey.dev", }); }); @@ -98,7 +98,7 @@ export const changeWorkspacePlan = rateLimitedProcedure(ratelimit.update) console.error(err); throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", - message: "Failed to change your plan. Please contact support using support@unkey.dev", + message: "Failed to change your plan. Please try again or contact support@unkey.dev", }); }); return { @@ -192,7 +192,7 @@ export const changeWorkspacePlan = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to change plans. Please contact support using support@unkey.dev", + "We are unable to change plans. Please try again or contact support@unkey.dev", }); }); return { title: "Your workspace has been upgraded" }; diff --git a/apps/dashboard/lib/trpc/routers/workspace/create.ts b/apps/dashboard/lib/trpc/routers/workspace/create.ts index 94b2fd495e..b8a3f6e1c5 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/create.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/create.ts @@ -99,7 +99,7 @@ export const createWorkspace = rateLimitedProcedure(ratelimit.create) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable to create the workspace. Please contact support using support@unkey.dev", + "We are unable to create the workspace. Please try again or contact support@unkey.dev", }); }); diff --git a/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts b/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts index c217d2e540..be49661d08 100644 --- a/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts +++ b/apps/dashboard/lib/trpc/routers/workspace/optIntoBeta.ts @@ -20,7 +20,7 @@ export const optWorkspaceIntoBeta = rateLimitedProcedure(ratelimit.update) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: - "We are unable opt you in to this beta feature. Please contact support using support@unkey.dev", + "We are unable opt you in to this beta feature. Please try again or contact support@unkey.dev", }); });