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
{{ message }}
This repository has been archived by the owner on Jul 4, 2020. It is now read-only.
I get the following error whenever I use any of the load functions:
error: { RequestError: Requests can only be made in the LoggedIn state, not the SentClientRequest state at Request.tds.Request.err [as userCallback] (C:\Dev\gema\api\node_modules\mssql\lib\tedious.js:614:19) at Request._this.callback (C:\Dev\gema\api\node_modules\tedious\lib\request.js:61:27) at Connection.makeRequest (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1606:17) at Connection.execSql (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1369:12) at Immediate.parent.acquire [as _onImmediate] (C:\Dev\gema\api\node_modules\mssql\lib\tedious.js:838:63) at runCallback (timers.js:697:11) at tryOnImmediate (timers.js:667:5) at processImmediate (timers.js:649:5) at process.topLevelDomainCallback (domain.js:121:23) code: 'EINVALIDSTATE', number: 'EINVALIDSTATE', state: undefined, originalError: { RequestError: Requests can only be made in the LoggedIn state, not the SentClientRequest state at RequestError (C:\Dev\gema\api\node_modules\tedious\lib\errors.js:34:12) at Connection.makeRequest (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1606:26) at Connection.execSql (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1369:12) at Immediate.parent.acquire [as _onImmediate] (C:\Dev\gema\api\node_modules\mssql\lib\tedious.js:838:63) at runCallback (timers.js:697:11) at tryOnImmediate (timers.js:667:5) at processImmediate (timers.js:649:5) at process.topLevelDomainCallback (domain.js:121:23) message: 'Requests can only be made in the LoggedIn state, not the SentClientRequest state', code: 'EINVALIDSTATE' }, name: 'RequestError', precedingErrors: [] } query: COMMIT
index.js
import "reflect-metadata";
import { ApolloServer } from "apollo-server-express";
import * as Express from "express";
import { createConnection } from "typeorm";
import { createSchema } from "./utils/createSchema";
import { GraphQLDatabaseLoader } from "typeorm-loader";
const main = async () => {
const schema = await createSchema();
const connection = await createConnection(/* loaded from ormconfig.json */);
const loader = new GraphQLDatabaseLoader(connection);
const apolloServer = new ApolloServer({
context: ({ request, response }: any) => ({
request,
response,
loader
}),
schema
});
const app = Express();
apolloServer.applyMiddleware({ app });
app.listen(4000, () => {
console.log("Server Started on http://localhost:4000/graphql");
});
};
main();
I think the issue may be related to TypeORM still using the connection when using the loader directly in the entity @field. If I move the loader into a @FieldResolver in the @resolver the issue goes away.
I get the following error whenever I use any of the load functions:
error: { RequestError: Requests can only be made in the LoggedIn state, not the SentClientRequest state at Request.tds.Request.err [as userCallback] (C:\Dev\gema\api\node_modules\mssql\lib\tedious.js:614:19) at Request._this.callback (C:\Dev\gema\api\node_modules\tedious\lib\request.js:61:27) at Connection.makeRequest (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1606:17) at Connection.execSql (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1369:12) at Immediate.parent.acquire [as _onImmediate] (C:\Dev\gema\api\node_modules\mssql\lib\tedious.js:838:63) at runCallback (timers.js:697:11) at tryOnImmediate (timers.js:667:5) at processImmediate (timers.js:649:5) at process.topLevelDomainCallback (domain.js:121:23) code: 'EINVALIDSTATE', number: 'EINVALIDSTATE', state: undefined, originalError: { RequestError: Requests can only be made in the LoggedIn state, not the SentClientRequest state at RequestError (C:\Dev\gema\api\node_modules\tedious\lib\errors.js:34:12) at Connection.makeRequest (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1606:26) at Connection.execSql (C:\Dev\gema\api\node_modules\tedious\lib\connection.js:1369:12) at Immediate.parent.acquire [as _onImmediate] (C:\Dev\gema\api\node_modules\mssql\lib\tedious.js:838:63) at runCallback (timers.js:697:11) at tryOnImmediate (timers.js:667:5) at processImmediate (timers.js:649:5) at process.topLevelDomainCallback (domain.js:121:23) message: 'Requests can only be made in the LoggedIn state, not the SentClientRequest state', code: 'EINVALIDSTATE' }, name: 'RequestError', precedingErrors: [] } query: COMMIT
index.js
Then in my Entity:
Any thoughts? Is this a unique issue with using the mssql driver?
The text was updated successfully, but these errors were encountered: