diff --git a/app/common/orgNameUtils.ts b/app/common/orgNameUtils.ts index ed03c387..3b682575 100644 --- a/app/common/orgNameUtils.ts +++ b/app/common/orgNameUtils.ts @@ -41,7 +41,7 @@ const BLACKLISTED_SUBDOMAINS = new Set([ export function checkSubdomainValidity(subdomain: string): void { // stick with limited alphanumeric subdomains. if (!(/^[a-z0-9][-a-z0-9]*$/.test(subdomain))) { - throw new Error('Domain must include letters, numbers, and dashes only.'); + throw new Error('Domain must include lower-case letters, numbers, and dashes only.'); } // 'docs-*' is reserved for personal orgs. if (subdomain.startsWith('docs-')) { throw new Error('Domain cannot use reserved prefix "docs-".'); } diff --git a/app/server/companion.ts b/app/server/companion.ts index 7b527922..e6589ebf 100644 --- a/app/server/companion.ts +++ b/app/server/companion.ts @@ -80,14 +80,14 @@ export function addSiteCommand(program: commander.Command, // This should not happen. throw new Error('failed to create user'); } - await db.addOrg(user, { + db.unwrapQueryResult(await db.addOrg(user, { name: domain, domain, }, { setUserAsOwner: false, useNewPlan: true, planType: 'teamFree' - }); + })); }); } diff --git a/stubs/app/server/server.ts b/stubs/app/server/server.ts index aa961daa..1516013d 100644 --- a/stubs/app/server/server.ts +++ b/stubs/app/server/server.ts @@ -86,14 +86,14 @@ export async function main() { // This should not happen. throw new Error('failed to create GRIST_DEFAULT_EMAIL user'); } - await db.addOrg(user, { + db.unwrapQueryResult(await db.addOrg(user, { name: org, domain: org, }, { setUserAsOwner: false, useNewPlan: true, planType: TEAM_FREE_PLAN - }); + })); } } @@ -102,6 +102,7 @@ export async function main() { if (process.env.GRIST_TESTING_SOCKET) { await server.addTestingHooks(); } + return server; } if (require.main === module) {