From 895e07557214d5e1a1cc6046251b9ee6920bc487 Mon Sep 17 00:00:00 2001 From: maxlkatze Date: Tue, 23 Jul 2024 13:16:34 +0200 Subject: [PATCH] fix(katzencore): Fixed Option Loading in Client Driver --- src/runtime/storage/StorageManagement.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/runtime/storage/StorageManagement.ts b/src/runtime/storage/StorageManagement.ts index a621091..8ecbcac 100644 --- a/src/runtime/storage/StorageManagement.ts +++ b/src/runtime/storage/StorageManagement.ts @@ -57,17 +57,19 @@ export const useContentStorage = async (_runtimeConfig: RuntimeConfig): Promise< } let driver: Driver + const copiedOptions = JSON.parse(JSON.stringify(runtimeConfig.storage.options)) try { const nitroPackImport = module as DynamicNitroPackImport - driver = nitroPackImport(runtimeConfig.storage.options) as Driver + driver = nitroPackImport(copiedOptions) as Driver } - catch (e) { + catch (e1) { try { const moduleImport = module as DynamicModuleImport - driver = moduleImport.default(runtimeConfig.storage.options) as Driver + driver = moduleImport.default(copiedOptions) as Driver } - catch (e) { - throw new Error(`Driver ${runtimeConfig.storage.type} could not be imported`) + catch (e2) { + console.log('\x1B[41m\x1B[30m !Katze \x1B[0m Have you installed the driver for the storage type? Consult the unstorage documentation for more information') + throw new Error(`Driver ${runtimeConfig.storage.type} could not be imported, possible error: ${e1}, ${e2}`) } }