b310-digital / teammapper

Mindmapping made simple: Host and create your own mindmaps. Share your mindmap sessions with your team and collaborate on mindmaps.
https://teammapper.org
MIT License
256 stars 21 forks source link

Chore: Catch FK exception #493

Closed JannikStreek closed 1 month ago

JannikStreek commented 1 month ago

Describe the bug Please catch and log with warn the following exceptions:

2024-09-30 21:24:33.650 
    at async MapsService.updateMap (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:176:5)
2024-09-30 21:24:33.650 
    at async MapsService.addNodesFromClient (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:80:12)
2024-09-30 21:24:33.650 
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:93:31)
2024-09-30 21:24:33.650 
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:95:40)
2024-09-30 21:24:33.650 
    at async EntityPersistExecutor.execute (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/EntityPersistExecutor.ts:182:21)
2024-09-30 21:24:33.650 
    at async SubjectExecutor.execute (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/SubjectExecutor.ts:137:9)
2024-09-30 21:24:33.650 
    at async SubjectExecutor.executeInsertOperations (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/SubjectExecutor.ts:435:42)
2024-09-30 21:24:33.650 
    at async InsertQueryBuilder.execute (/home/node/app/teammapper-backend/node_modules/typeorm/query-builder/src/query-builder/InsertQueryBuilder.ts:163:33)
2024-09-30 21:24:33.650 
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2024-09-30 21:24:33.650 
    at PostgresQueryRunner.query (/home/node/app/teammapper-backend/node_modules/typeorm/driver/src/driver/postgres/PostgresQueryRunner.ts:331:19)
2024-09-30 21:24:33.650 
QueryFailedError: insert or update on table "mmp_node" violates foreign key constraint "FK_336300b82c56a05f0317f229420"
2024-09-30 21:24:33.650 
2024-09-30 21:24:33.650 
[Nest] 54  - 09/30/2024, 7:24:33 PM   ERROR [WsExceptionsHandler] insert or update on table "mmp_node" violates foreign key constraint "FK_336300b82c56a05f0317f229420"
2024-09-30 21:24:33.446 
    at async MapsGateway.updateMap (/home/node/app/teammapper-backend/src/map/controllers/maps.gateway.ts:179:5)
2024-09-30 21:24:33.446 
    at async MapsService.updateMap (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:176:5)
2024-09-30 21:24:33.446 
    at async MapsService.addNodesFromClient (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:80:12)
2024-09-30 21:24:33.446 
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:95:40)
2024-09-30 21:24:33.446 
    at async EntityPersistExecutor.execute (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/EntityPersistExecutor.ts:182:21)
2024-09-30 21:24:33.446 
    at async SubjectExecutor.execute (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/SubjectExecutor.ts:137:9)
2024-09-30 21:24:33.446 
    at async SubjectExecutor.executeInsertOperations (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/SubjectExecutor.ts:435:42)
2024-09-30 21:24:33.446 
    at async InsertQueryBuilder.execute (/home/node/app/teammapper-backend/node_modules/typeorm/query-builder/src/query-builder/InsertQueryBuilder.ts:163:33)
2024-09-30 21:24:33.446 
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2024-09-30 21:24:33.446 
    at PostgresQueryRunner.query (/home/node/app/teammapper-backend/node_modules/typeorm/driver/src/driver/postgres/PostgresQueryRunner.ts:331:19)
2024-09-30 21:24:33.446 
QueryFailedError: insert or update on table "mmp_node" violates foreign key constraint "FK_336300b82c56a05f0317f229420"
2024-09-30 17:50:05.706 
QueryFailedError: insert or update on table "mmp_node" violates foreign key constraint "FK_336300b82c56a05f0317f229420"
2024-09-30 17:50:05.706 
[Nest] 54  - 09/30/2024, 3:50:05 PM   ERROR [WsExceptionsHandler] insert or update on table "mmp_node" violates foreign key constraint "FK_336300b82c56a05f0317f229420"
2024-09-30 17:50:05.567 
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:93:31)
2024-09-30 17:50:05.567 
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:93:31)
2024-09-30 17:50:05.567 
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:93:31)
2024-09-30 17:50:05.567 
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:95:40)
2024-09-30 17:50:05.567 
    at async EntityPersistExecutor.execute (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/EntityPersistExecutor.ts:182:21)
2024-09-30 17:50:05.567 
    at async SubjectExecutor.execute (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/SubjectExecutor.ts:137:9)
2024-09-30 17:50:05.567 
    at async SubjectExecutor.executeInsertOperations (/home/node/app/teammapper-backend/node_modules/typeorm/persistence/src/persistence/SubjectExecutor.ts:435:42)
2024-09-30 17:50:05.567 
    at async InsertQueryBuilder.execute (/home/node/app/teammapper-backend/node_modules/typeorm/query-builder/src/query-builder/InsertQueryBuilder.ts:163:33)
2024-09-30 17:50:05.567 
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2024-09-30 17:50:05.567 
    at PostgresQueryRunner.query (/home/node/app/teammapper-backend/node_modules/typeorm/driver/src/driver/postgres/PostgresQueryRunner.ts:331:19)

If possible, a test case would be cool that tries to trigger this exception. Please see schema / migrations for the foreign key that is involved.