Skip to content

Commit 7962036

Browse files
phong-innomizetechpleerock
authored andcommitted
fix: connection Reuse is broken in a Lambda environment: (#4804)
* Connection Reuse is broken in a Lambda environment: - Fix issue find metadata does not exist with webpack * Fix typing and missing bracket
1 parent c30b485 commit 7962036

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/connection/Connection.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,12 @@ export class Connection {
481481
*/
482482
protected findMetadata(target: Function|EntitySchema<any>|string): EntityMetadata|undefined {
483483
return this.entityMetadatas.find(metadata => {
484-
if (metadata.target === target)
484+
if (typeof metadata.target === "function" && typeof target === "function" && metadata.target.name === target.name) {
485485
return true;
486+
}
487+
if (metadata.target === target) {
488+
return true;
489+
}
486490
if (target instanceof EntitySchema) {
487491
return metadata.name === target.options.name;
488492
}

0 commit comments

Comments
 (0)