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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user