From d733c2e653c1072a2d9f7b4fb05da78630c4a4fe Mon Sep 17 00:00:00 2001 From: giancarlo Date: Fri, 19 Apr 2024 13:17:33 +0800 Subject: [PATCH] Update Keystatic client availability check The check for Keystatic client availability has been updated to also consider the KEYSTATIC_STORAGE_KIND environment variable. The error message has been adapted accordingly to reflect that the client in "Local" mode is only available in a Node.js runtime. --- packages/cms/core/src/create-cms-client.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/cms/core/src/create-cms-client.ts b/packages/cms/core/src/create-cms-client.ts index bee8f8ddc..c0cd6be6d 100644 --- a/packages/cms/core/src/create-cms-client.ts +++ b/packages/cms/core/src/create-cms-client.ts @@ -34,14 +34,17 @@ async function getWordpressClient() { } async function getKeystaticClient() { - if (process.env.NEXT_RUNTIME === 'nodejs') { + if ( + process.env.NEXT_RUNTIME === 'nodejs' || + process.env.KEYSTATIC_STORAGE_KIND !== 'local' + ) { const { KeystaticClient } = await import('../../keystatic/src/client'); return new KeystaticClient(); } console.error( - `[CMS] Keystatic client is only available in Node.js runtime. Please choose a different CMS client. Returning a mock client instead of throwing an error.`, + `[CMS] Keystatic client using "Local" mode is only available in Node.js runtime. Please choose a different CMS client. Returning a mock client instead of throwing an error.`, ); return mockCMSClient() as unknown as CmsClient;