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
We were having issues with our foreignKey references when they were pointing to columns that were not primary keys. This patch allowed us to use foreignKeys without them having to be primary keys.
This error was encountered in the following versions:
adminJS 6.0.0
@adminJs/Prisma 2.0.0
We were getting this error
Error:
Invalid `this.manager.findMany()` invocation in
node_modules/@adminjs/prisma/lib/Resource.js:88:48
85 const idProperty = this.properties().find((property) => property.isId());
86 if (!idProperty)
87 return [];
→ 88 const results = yield this.manager.findMany({
where: {
id: {
in: [
'[email protected]'
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
}
})
Argument in: Got invalid value
[
'[email protected]'
]
on prisma.findManyuser. Provided List<String>, expected List<Int>.
at Document.validate (/node_modules/@prisma/client/runtime/index.js:47823:20)
at PrismaClient._executeRequest (/node_modules/@prisma/client/runtime/index.js:49972:17)
at consumer (/node_modules/@prisma/client/runtime/index.js:49916:23)
at /node_modules/@prisma/client/runtime/index.js:49920:76
at runInChildSpan (/node_modules/@prisma/client/runtime/index.js:49133:12)
at /node_modules/@prisma/client/runtime/index.js:49920:20
at AsyncResource.runInAsyncScope (node:async_hooks:199:9)
at PrismaClient._request (/node_modules/@prisma/client/runtime/index.js:49919:86)
at /node_modules/@prisma/client/runtime/index.js:46474:25
at _callback (/node_modules/@prisma/client/runtime/index.js:46233:52)
The changes below were our solution
adminjs patch
index dad1696..83620d2 100644
--- a/node_modules/adminjs/lib/backend/utils/populator/populate-property.js+++ b/node_modules/adminjs/lib/backend/utils/populator/populate-property.js@@ -30,6 +30,7 @@ async function populateProperty(records, property) {
}
const referencedResource = property.reference();
+ const referencedProperty = property;
if (!referencedResource) {
throw new Error([`There is no reference resource named: "${property.property.reference}"`, `for property: "${decoratedResource.id()}.properties.${property.propertyPath}"`].join('\n'));
@@ -70,7 +71,7 @@ async function populateProperty(records, property) {
} // now find all referenced records: all users
- const referenceRecords = await referencedResource.findMany(uniqueExternalIds); // even if record has value for this reference - it might not have the referenced record itself+ const referenceRecords = await referencedResource.findMany(uniqueExternalIds, referencedProperty); // even if record has value for this reference - it might not have the referenced record itself
// this happens quite often in mongodb where there are no constrains on the database
if (!referenceRecords || !referenceRecords.length) {
Hello, we are also facing a similar issue where we have some resources referencing some non primary foreign keys, which broke the corresponding resource pages, your solution seems to fix our issue as well thanks for the solution, I still don't know how might we apply this to a dockerized solution.
We were having issues with our foreignKey references when they were pointing to columns that were not primary keys. This patch allowed us to use foreignKeys without them having to be primary keys.
This error was encountered in the following versions:
adminJS 6.0.0
@adminJs/Prisma 2.0.0
We were getting this error
The changes below were our solution
adminjs patch
@adminjs/prisma patch
The text was updated successfully, but these errors were encountered: