vesper
vesper copied to clipboard
CRITICAL: TypeError: Cannot read property 'type' of undefined
This line is exploding:
https://github.com/vesper-framework/vesper/blob/master/src/index.ts#L115
I tried to understand why sometimes the connection options exist and why it sometimes does not exist.
The bug only appears if the UI triggers many operations at once, sending many async requests to the server. It fails both with postgres and sqlite.
This is a sad bug as it makes vesper unusable because random queries fail.
thanks for the PR but its not a fix. I never faced the issue you are describing, can you please elaborate and provide more information, some real reproduction?
Here is a demo of the bug in action:
The first part of this gif shows the original vesper code. The second part shows with the fix.
As you can see, batch operations fail with current vesper code but work fine with the fix I propose.
If you want to reproduce this, you can close this repo.
Use origin/vesper
branch !!
https://github.com/lucidogen/lucidogen
The server is in packages/apps/todomvc-server
, the client app is in packages/apps/todomvc
.
You need to run npm i && npm run start
in each of these directories.
(at the end of the gif, you can see the error reported in the terminal: due to ts-node, the file is wrong but when using tsc and then the JS file, it is effectively from index.js in vesper).
@pleerock Hi, I have pretty the same issue, when trying to run many mutations simultaneously. I get:
TypeError: this.connection.getMetadata is not a function
TypeError: this.connection.getMetadata is not a function
at EntityManager.<anonymous> (D:\PROG\gm-intelligence\chatbot.gql-server\src\entity-manager\EntityManager.ts:575:42)
at step (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:32:23)
at Object.next (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:13:53)
at D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:7:71
at Promise (<anonymous>)
at __awaiter (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:3:12)
at EntityManager.findOne (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:431:16)
at EntityManager.<anonymous> (D:\PROG\gm-intelligence\chatbot.gql-server\src\entity-manager\EntityManager.ts:620:21)
at step (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:32:23)
at Object.next (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:13:53)
at EntityManager.<anonymous> (D:\PROG\gm-intelligence\chatbot.gql-server\src\entity-manager\EntityManager.ts:575:42)
TypeError: Cannot read property 'type' of undefined
at D:\PROG\gm-intelligence\chatbot.gql-server\src\index.ts:141:60
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at step (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:32:23)
at Object.next (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:13:53)
at D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:7:71
at Promise (<anonymous>)
at __awaiter (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:3:12)
at EntityManager.findOne (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:431:16)
at EntityManager.<anonymous> (D:\PROG\gm-intelligence\chatbot.gql-server\src\entity-manager\EntityManager.ts:620:21)
at step (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:32:23)
at Object.next (D:\PROG\gm-intelligence\chatbot.gql-server\node_modules\typeorm\entity-manager\EntityManager.js:13:53)
on random of those requests. @gaspard fix doesn't really help since I just get another undefined errors. It looks like container from typeDI doesn't inject all deps properly in time of those requests..or something like that.
My tsconfig.json config:
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["es6", "esnext", "dom"],
"module": "esnext",
"moduleResolution": "node",
"outDir": "build/dist",
"rootDir": "src",
"sourceMap": true,
"target": "es5"
},
I'm on windows 10, using postgress for DB and folllowing deps versions:
"pg": "^7.4.3",
"typeorm": "^0.2.7",
"typescript": "^2.9.2",
"vesper": "^0.1.9"
Let me know if you need some more info or anything.
@AntonPuko @gaspard vesper mutation controller has the transaction params to true as default. Make sure you set it to false and test it again.
@yubozhao yep, it works with transactions disabled for those queries.