Describe the problem/error/question
Hi,
I’m setting up an OIDC server to work with n8n. Everything was working fine, but after I changed the User role provisioning setting to “Instance and project roles”, new users are no longer able to log in.
Interestingly, the login still works perfectly for users who already exist in the system. It seems like the automatic provisioning for new accounts is failing under this specific role setting.
Could you help me identify what could cause the error?
Thanks!
What is the error message (if any)?
{"code":0,"message":"insert or update on table \"project_relation\" violates foreign key constraint \"FK_5f0643f6717905a05164090dde7\"","stacktrace":"QueryFailedError: insert or update on table \"project_relation\" violates foreign key constraint \"FK_5f0643f6717905a05164090dde7\"\n at PostgresQueryRunner.query (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/src/driver/postgres/PostgresQueryRunner.ts:331:19)\n at processTicksAndRejections (node:internal/process/task_queues:105:5)\n at InsertQueryBuilder.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/src/query-builder/InsertQueryBuilder.ts:142:33)\n at SubjectExecutor.executeInsertOperations (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/src/persistence/SubjectExecutor.ts:385:38)\n at SubjectExecutor.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/src/persistence/SubjectExecutor.ts:134:9)\n at EntityPersistExecutor.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/src/persistence/EntityPersistExecutor.ts:182:21)\n at ProjectService.addUser (/usr/local/lib/node_modules/n8n/src/services/project.service.ee.ts:584:10)\n at /usr/local/lib/node_modules/n8n/src/modules/provisioning.ee/provisioning.service.ee.ts:251:5\n at EntityManager.transaction (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/src/entity-manager/EntityManager.ts:152:28)\n at ProvisioningService.provisionProjectRolesForUser (/usr/local/lib/node_modules/n8n/src/modules/provisioning.ee/provisioning.service.ee.ts:245:3)"}
docker logs:
n8n-main | 15:25:38.366 error insert or update on table “project_relation” violates foreign key constraint “FK_5f0643f6717905a05164090dde7” { “file”: “error-reporter.js”, “function”: “defaultReport” }
Information on your n8n setup
- n8n version: 2.4.4
- Database (default: SQLite): PostgreSQL
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: MacOS 26.3