diff --git a/packages/services/auth-service/src/application/services/auth.service.ts b/packages/services/auth-service/src/application/services/auth.service.ts index e096718..d164fcc 100644 --- a/packages/services/auth-service/src/application/services/auth.service.ts +++ b/packages/services/auth-service/src/application/services/auth.service.ts @@ -208,11 +208,15 @@ export class AuthService { phone?: string, ) { // Generate slug from company name (underscores for valid PostgreSQL schema names) - const slug = companyName + let slug = companyName .toLowerCase() .replace(/[^a-z0-9]+/g, '_') .replace(/(^_|_$)/g, '') .slice(0, 40); + // If company name is all non-ASCII (e.g. Chinese), slug will be empty — use UUID fallback + if (!slug) { + slug = crypto.randomUUID().replace(/-/g, '').slice(0, 16); + } // Check slug uniqueness const existingTenant = await this.tenantRepository.findOneBy({ slug });