diff --git a/server/account/src/index.ts b/server/account/src/index.ts index eb7b614ec1..4599b01a7f 100644 --- a/server/account/src/index.ts +++ b/server/account/src/index.ts @@ -340,7 +340,7 @@ export async function listWorkspaces (db: Db, productId: string): Promise(WORKSPACE_COLLECTION) - .find({ productId: { $exists: false } }) + .find({ $or: [{ productId: { $exists: false } }, { productId: '' }] }) .toArray() } return await db.collection(WORKSPACE_COLLECTION).find({ productId }).toArray() @@ -397,7 +397,9 @@ export async function upgradeWorkspace ( throw new PlatformError(new Status(Severity.ERROR, accountPlugin.status.WorkspaceNotFound, { workspace })) } if (ws.productId !== productId) { - throw new PlatformError(new Status(Severity.ERROR, accountPlugin.status.ProductIdMismatch, { productId })) + if (productId !== '' || ws.productId !== undefined) { + throw new PlatformError(new Status(Severity.ERROR, accountPlugin.status.ProductIdMismatch, { productId })) + } } await db.collection(WORKSPACE_COLLECTION).updateOne( { workspace },