Skip to content

Commit

Permalink
fix: connection Reuse is broken in a Lambda environment: (#4804)
Browse files Browse the repository at this point in the history
* Connection Reuse is broken in a Lambda environment:
- Fix issue find metadata does not exist with webpack

* Fix typing and missing bracket
  • Loading branch information
phong-innomizetech authored and pleerock committed Oct 18, 2019
1 parent c30b485 commit 7962036
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/connection/Connection.ts
Expand Up @@ -481,8 +481,12 @@ export class Connection {
*/
protected findMetadata(target: Function|EntitySchema<any>|string): EntityMetadata|undefined {
return this.entityMetadatas.find(metadata => {
if (metadata.target === target)
if (typeof metadata.target === "function" && typeof target === "function" && metadata.target.name === target.name) {
return true;
}
if (metadata.target === target) {
return true;
}
if (target instanceof EntitySchema) {
return metadata.name === target.options.name;
}
Expand Down

0 comments on commit 7962036

Please sign in to comment.