diff --git a/packages/shared/lib/seeders/account.seeder.ts b/packages/shared/lib/seeders/account.seeder.ts index 867d18aa50..c2d3fcc20d 100644 --- a/packages/shared/lib/seeders/account.seeder.ts +++ b/packages/shared/lib/seeders/account.seeder.ts @@ -3,7 +3,7 @@ import accountService from '../services/account.service.js'; import type { DBTeam } from '@nangohq/types'; export async function createAccount(): Promise { - const acc = await accountService.getOrCreateAccount(uuid()); + const acc = await accountService.getOrCreateAccount(uuid(), false); if (!acc) { throw new Error('failed_to_create_account'); } diff --git a/packages/shared/lib/services/account.service.ts b/packages/shared/lib/services/account.service.ts index 78b2543959..62023701f1 100644 --- a/packages/shared/lib/services/account.service.ts +++ b/packages/shared/lib/services/account.service.ts @@ -61,7 +61,7 @@ class AccountService { return account[0].uuid; } - async getOrCreateAccount(name: string): Promise { + async getOrCreateAccount(name: string, createDefaultEnvironments = true): Promise { const account: DBTeam[] = await db.knex.select('id').from(`_nango_accounts`).where({ name }); if (account == null || account.length == 0 || !account[0]) { @@ -70,7 +70,10 @@ class AccountService { if (!newAccount || newAccount.length == 0 || !newAccount[0]) { throw new Error('Failed to create account'); } - await environmentService.createDefaultEnvironments(newAccount[0]['id']); + + if (createDefaultEnvironments) { + await environmentService.createDefaultEnvironments(newAccount[0]['id']); + } return newAccount[0]; }