Feature(s) impacted
I’m calling the following function somewhere, and this leads to an error according to the failure logs below. The relationships addressed in the second argument of the list function are configured correctly as many-to-one relationships, since I can validate it in the UI. Any idea what might be the issue here?
...
const items = await context.dataSource.getCollection('legalProductOrders_items').list(
{
conditionTree: {
field: 'parentId',
operator: 'In',
value: records.map((r) => r._id.toString()),
},
},
['legalProductItem:legalProduct:nameEN', 'parentId']
);
...
Failure Logs
===== An exception was raised =====
GET /forest/legalProductOrders?{
timezone: Europe/Zurich,
fields[client__manyToOne]: _id,
fields[legalProductOrders]: _id,client__manyToOne,cogs,completionDate,createdAt,fulfillmentStatus,notionPageId,paymentStatus,product,serviceProviderInvoiceReceived,serviceProviderOrderAccepted,source,serviceProviderOrderSubmitted,updatedAt,sourceMedium,
page[number]: 1,
page[size]: 15,
sort: -createdAt
}
Cannot read properties of undefined (reading 'foreignCollection')
TypeError: Cannot read properties of undefined (reading 'foreignCollection')
at rewriteField (/Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-customizer/src/decorators/computed/helpers/rewrite-projection.ts:10:68)
at /Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-customizer/src/decorators/computed/collection.ts:58:68
at Projection.map (<anonymous>)
at Projection.replace (/Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-toolkit/src/interfaces/query/projection/index.ts:29:17)
at ComputedCollection.list (/Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-customizer/src/decorators/computed/collection.ts:58:40)
at RelaxedCollection.list (/Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-customizer/src/context/relaxed-wrappers/collection.ts:120:34)
at Object.getValues (/Users/davidroegiers/Jurata/jurata-next/forest-2/customizations/legal-product-orders.ts:54:88)
at /Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-customizer/src/decorators/computed/helpers/compute-fields.ts:23:56
at transformUniqueValues (/Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-customizer/src/decorators/computed/utils/deduplication.ts:26:31)
at computeField (/Users/davidroegiers/Jurata/jurata-next/forest-2/node_modules/@forestadmin/datasource-customizer/src/decorators/computed/helpers/compute-fields.ts:15:31)
===================================
Context
- Project name: jurata
- Team name: jurata-2
- Environment name: Development
- Agent (forest package) name & version:
"@forestadmin/agent": "^1.13.1"
- Database type: MongoDB
- Recent changes made on your end if any: green field solution