Note:
It seem to be caused by a self reference relationship: a workspace can have a template (which is also a workspace object).
The problem disappeared when I did a migration to remove the relationship.
You can find here a dump of the sql schema of the table and my .forestadmin-schema.json
Expected behavior
I would expect to be able to display the elements of the collection and be able to edit an item.
Failure Logs
table name "Workspace" specified more than once
Error:
at Query.run (/Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/dialects/postgres/query.js:76:25)
at /Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/sequelize.js:641:28
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at PostgresQueryInterface.select (/Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
at Function.findAll (/Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/model.js:1816:21)
at SequelizeCollection.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-sequelize@1.0.0-beta.36_sequelize@6.21.3/node_modules/@forestadmin/datasource-sequelize/src/collection.ts:91:21)
at ComputedCollection.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.27/node_modules/@forestadmin/datasource-toolkit/src/decorators/computed/collection.ts:52:21)
at RelationCollectionDecorator.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.27/node_modules/@forestadmin/datasource-toolkit/src/decorators/relation/collection.ts:37:21)
at ComputedCollection.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.27/node_modules/@forestadmin/datasource-toolkit/src/decorators/computed/collection.ts:52:21)
at CollectionHookDecorator.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.27/node_modules/@forestadmin/datasource-toolkit/src/decorators/hook/collection.ts:79:21)
Context
Project name: Capsule
Team name: Founders
Environment name: production
Agent type & version: @forestadmin/agent 1.0.0-beta.47
Recent changes made on your end if any: problem as been present from install
@jeffladiray Thank you for your quick response !
Do you have an ETA for the resolution? Is it possible to get the link to the bug report?
While you fix the problem, is there any way to fix this on my side?
Removing the constraint is not really an option because itās need by my ORM (prisma) to create the relationship. But I guess there are other options:
Can I make Forest understand the relationship? (with something like this)
Or even overwrite the route? (but I canāt find the equivalent of this documention for the v2)
Sadly, the issue happens at the introspection level - before the agent even start. AFAIK (I wait for the tech-team to check whether or not thatās true), there are no obvious way to workaround this issue at the moment.
We usually donāt give ETA on bug fixes, but be sure that it is already dispatched in the tech-team and that we are working on the fix as we speak.
Hi @anon39940173,
Thank you for your work !
I saw that this PR was released as @forestadmin/agent@1.0.0-beta.54 and @forestadmin/datasource-sql@1.0.0-beta.47.
Unfortunately, I still get the same error:
table name "Workspace" specified more than once
Error:
at Query.run (/Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/dialects/postgres/query.js:76:25)
at /Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/sequelize.js:641:28
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at PostgresQueryInterface.select (/Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
at Function.findAll (/Users/leonard/code/capsule/node_modules/.pnpm/sequelize@6.21.3_pg@8.8.0/node_modules/sequelize/src/model.js:1816:21)
at SequelizeCollection.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-sequelize@1.0.0-beta.40_sequelize@6.21.3/node_modules/@forestadmin/datasource-sequelize/src/collection.ts:91:21)
at ComputedCollection.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.30/node_modules/@forestadmin/datasource-toolkit/src/decorators/computed/collection.ts:52:21)
at RelationCollectionDecorator.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.30/node_modules/@forestadmin/datasource-toolkit/src/decorators/relation/collection.ts:37:21)
at ComputedCollection.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.30/node_modules/@forestadmin/datasource-toolkit/src/decorators/computed/collection.ts:52:21)
at CollectionHookDecorator.list (/Users/leonard/code/capsule/node_modules/.pnpm/@forestadmin+datasource-toolkit@1.0.0-beta.30/node_modules/@forestadmin/datasource-toolkit/src/decorators/hook/collection.ts:79:21)
Is there something I should change in my code?
Thank you in advance !!
Can you send me information about the structure of the tables involved in the failing request?
A couple of create table statements that I can run on a local database would be best, but I would settle with anything that enables me to replicate the issue.