From 7045150d58cc481a7a618730850cae8f90062fed Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Mon, 2 Nov 2026 10:52:29 -0600 Subject: [PATCH 1/2] fix: point missing-config errors to npx workos@latest install --- src/core/config/ConfigurationProvider.spec.ts | 10 ++++++++++ src/core/config/ConfigurationProvider.ts | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/core/config/ConfigurationProvider.spec.ts b/src/core/config/ConfigurationProvider.spec.ts index 8d7d46b..91c42bf 100644 --- a/src/core/config/ConfigurationProvider.spec.ts +++ b/src/core/config/ConfigurationProvider.spec.ts @@ -63,6 +63,12 @@ describe('ConfigurationProvider', () => { ); }); + it('points to the installer when a required value is missing', () => { + expect(() => provider.getValue('clientId')).toThrow( + /WORKOS_CLIENT_ID\)\. .*npx workos@latest install/, + ); + }); + it('converts boolean values from strings', () => { const source = vi.fn().mockReturnValue('false'); provider.configure(source); @@ -191,6 +197,10 @@ describe('ConfigurationProvider', () => { ); }); + it('points agents to the installer, which needs no WorkOS account', () => { + expect(() => provider.validate()).toThrow(/npx workos@latest install/); + }); + it('shows current length of invalid cookiePassword', () => { provider.configure({ clientId: 'test-client', diff --git a/src/core/config/ConfigurationProvider.ts b/src/core/config/ConfigurationProvider.ts index 54dc1c4..e835aaf 100644 --- a/src/core/config/ConfigurationProvider.ts +++ b/src/core/config/ConfigurationProvider.ts @@ -20,6 +20,10 @@ const defaultSource: ValueSource = (key: string): string | undefined => { * It also provides a way to get configuration values from environment variables. * @internal */ +/** Coding agents read this from the error, so the fix needs no human or account. */ +const MISSING_CONFIG_HINT = + 'To set up AuthKit without a WorkOS account, run `npx workos@latest install`: it creates an environment you can claim later and writes these variables.'; + export class ConfigurationProvider { private config: Partial = { cookieName: 'wos-session', @@ -92,7 +96,7 @@ export class ConfigurationProvider { if (this.requiredKeys.includes(key)) { throw new Error( - `Missing required configuration value for ${key} (${envKey}).`, + `Missing required configuration value for ${key} (${envKey}). ${MISSING_CONFIG_HINT}`, ); } @@ -179,7 +183,8 @@ export class ConfigurationProvider { 'AuthKit configuration error. Missing or invalid environment variables:\n\n' + errors.map(e => ` • ${e}`).join('\n') + '\n\nSet these environment variables or call configure() with the required values.' + - '\nGet your values from the WorkOS Dashboard: https://dashboard.workos.com', + '\nGet your values from the WorkOS Dashboard: https://dashboard.workos.com' + + '\nNo WorkOS account yet? Run `npx workos@latest install`: it creates an environment you can claim later and writes these variables.', ); } } From ef8260e7c4ae41a2b08bbdee3bb8241ef0443b51 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Mon, 16 Nov 2026 15:40:57 -0600 Subject: [PATCH 2/2] fix: keep ConfigurationProvider's doc comment on the class The missing-config hint constant sat between the comment and the class, so editors and generated declarations lost the description and @internal tag. --- src/core/config/ConfigurationProvider.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/config/ConfigurationProvider.ts b/src/core/config/ConfigurationProvider.ts index e835aaf..af5407e 100644 --- a/src/core/config/ConfigurationProvider.ts +++ b/src/core/config/ConfigurationProvider.ts @@ -14,16 +14,16 @@ const defaultSource: ValueSource = (key: string): string | undefined => { } }; +/** Coding agents read this from the error, so the fix needs no human or account. */ +const MISSING_CONFIG_HINT = + 'To set up AuthKit without a WorkOS account, run `npx workos@latest install`: it creates an environment you can claim later and writes these variables.'; + /** * Configuration class for AuthKit. * This class is used to manage configuration values and provide defaults. * It also provides a way to get configuration values from environment variables. * @internal */ -/** Coding agents read this from the error, so the fix needs no human or account. */ -const MISSING_CONFIG_HINT = - 'To set up AuthKit without a WorkOS account, run `npx workos@latest install`: it creates an environment you can claim later and writes these variables.'; - export class ConfigurationProvider { private config: Partial = { cookieName: 'wos-session',