You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Package versions and database engine type (please complete the following information):
Database Engine: postgres
TypeORM Version: ^0.2.42
Driver Version ^2.3.8
Describe the bug
When a "parent" entity is saved that has a related entity (e.g. @ManyToOne / @OneToMany) where the relationship is defined in TypeORM with cascade: true, the "cascade" happens and the child entity is saved, however any further nested (within the "child" being saved via cascade) entities are "undefined" and so when normalizeParams is called ... Object.keys(undefined) ... happens causing Cannot convert undefined or null to object.
I'm thinking this may have something to do with the @JoinColumn decorator being added. When I remove it, I don't see this issue.
The below example hopefully will add a bit of clarity.
When the channel is saved, with a channelVersion set on it, the below query is generated and the error is thrown. **Note that the publishedBy and publishedById are both marked as nullable - they should simply not be saved in the database, but instead it seems like the driver is attempting to save the relationship anyway.
Here is the query that is generated (obviously this is not a 100% full example, the important bit is the undefined!)
Package versions and database engine type (please complete the following information):
Describe the bug
When a "parent" entity is saved that has a related entity (e.g.
@ManyToOne
/@OneToMany
) where the relationship is defined in TypeORM withcascade: true
, the "cascade" happens and the child entity is saved, however any further nested (within the "child" being saved via cascade) entities are "undefined" and so whennormalizeParams
is called... Object.keys(undefined) ...
happens causingCannot convert undefined or null to object
.I'm thinking this may have something to do with the
@JoinColumn
decorator being added. When I remove it, I don't see this issue.The below example hopefully will add a bit of clarity.
To Reproduce
The "parent" entity:
The "child" entity:
When the error happens
When the
channel
is saved, with achannelVersion
set on it, the below query is generated and the error is thrown. **Note that thepublishedBy
andpublishedById
are both marked as nullable - they should simply not be saved in the database, but instead it seems like the driver is attempting to save the relationship anyway.Here is the query that is generated (obviously this is not a 100% full example, the important bit is the
undefined
!)If I remove
cascade: true
, then perhaps obviously the error does not happen, because whenchannel
is saved,channelVersion
is not automatically saved.Note that if I use the
postgres
driver (NOT using this data-api driver) there are no errors / everything works as expected.The text was updated successfully, but these errors were encountered: