File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
packages/stack-forge/src/config Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -167,14 +167,28 @@ export async function loadEncryptConfig(
167167 process . exit ( 1 )
168168 }
169169
170- const encryptClient = Object . values ( moduleExports ) [ 0 ] as EncryptionClient
170+ const encryptClient = Object . values ( moduleExports ) . find (
171+ ( value ) : value is EncryptionClient =>
172+ ! ! value &&
173+ typeof value === 'object' &&
174+ 'getEncryptConfig' in value &&
175+ typeof ( value as { getEncryptConfig ?: unknown } ) . getEncryptConfig ===
176+ 'function' ,
177+ )
171178
172179 if ( ! encryptClient ) {
173180 console . error (
174- `Error: No encrypt client found in ${ encryptClientPath } \n\nExport at least one encryptedTable() from your schema file .` ,
181+ `Error: No EncryptionClient export found in ${ encryptClientPath } .` ,
175182 )
176183 process . exit ( 1 )
177184 }
178185
179- return encryptClient . getEncryptConfig ( )
186+ const config = encryptClient . getEncryptConfig ( )
187+ if ( ! config ) {
188+ console . error (
189+ `Error: Encryption client in ${ encryptClientPath } has no initialized encrypt config.` ,
190+ )
191+ process . exit ( 1 )
192+ }
193+ return config
180194}
You can’t perform that action at this time.
0 commit comments