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
Describe the bug findOneInChannel accepts a typeorm options object to among other things allows you to select additional relations. TypeOrm allows two ways to do it, one the common array of string keys ['relation1', 'relation1.child'], which is deprecated and the second one which is an object { relation1: { child: true } }.
However, Vendure permits both styles but only processes the string array. The second style results in a confusing error Cannot read properties of undefined (reading 'propertyPath')
You can see that here, only an incoming property array is processed and any passed relations object is passed as is
Hi @michaelbromley!
I think the issue persists somewhere deep in the EntityHydrator service:
When I try to hydrate a custom entity's relations, sometimes I'm getting the very same error message: Cannot read properties of undefined (reading 'propertyPath')
I think it somehow related to the @OneToMany relations, in our scenario we have a Company entity, which can have multiple addresses.
The error only occours when I'm trying to load this type of relation with the entity hydrator.
If we're loading it directly with a query it works as we would expect.
FYI:
This issue seems to be within TypeORM, and if you define the other side of the relation, it doesn't seems to be happen. typeorm/typeorm#2283 (comment)
Describe the bug
findOneInChannel
accepts a typeorm options object to among other things allows you to select additional relations. TypeOrm allows two ways to do it, one the common array of string keys['relation1', 'relation1.child']
, which is deprecated and the second one which is an object{ relation1: { child: true } }
.However, Vendure permits both styles but only processes the string array. The second style results in a confusing error
Cannot read properties of undefined (reading 'propertyPath')
You can see that here, only an incoming property array is processed and any passed relations object is passed as is
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Also process incoming relations object
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: