New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid state; requests can only be made in the LoggedIn state, not the SentClientRequest state #19
Comments
I'm sorry, I've not had time to look at this yet. I'll take a look at the weekend. |
I've recreated the problem with your code, and I think that I understand the problem. The error that is reported, Your code always causes this problem on the second request. Each page request results in a call to this code.
Your I will leave the issue open until I have updated the documentation to make it clear that only one request can be performed on a connection at a time. |
Documentation updated. commit 6eb911a |
Here's the problem with this issue: There's no signal in the code (such that I can see) as to when I can successfully call again. I'm trying to make multiple queries in a row, and even if I wait for request.end before calling the next, I'm still running into this error. Edit: oops. As it turned out I had accidentally called my callback in the callback of the request without checking if it was an error. Disregard! |
You made me realise that the documentation doesn't make it clear enough that the |
Hi,
It looks the 1 second, is not enough, so I got getting the error mentioned here, many times, so i increased it to 5 second, but still git it from time to time. Is there a way to use Promise().then to be sure the fetchStock function is not re-called before the first call be completely executed.
|
I am still getting the same issue, please look at the code below: var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
var TYPES = require('tedious').TYPES;
var config2 = {
userName: 'dbuser',
password: 'dbpass',
server: 'mysqlserver.com',
options: {
database: 'msdb'
}
};
var connection = new Connection(config2);
connection.on('connect', function(err) {
if(err) {
console.log("Database connection is not established: \n"+err);
process.exit(0);
} else {
console.log("Connected"); // If no error, then good to proceed.
createTableOperation();
}
});
function createTableOperation() {
var query = "CREATE TABLE ClientDetailsTest(CLIENT_ID CHAR(5) PRIMARY KEY, CLIENT_NAME VARCHAR(25), CLIENT_CHANNEL VARCHAR(25))";
request = new Request(query, function(err){
if(err) {
console.log("Error while creating table: "+err);
process.exit(0);
}
});
connection.execSql(request);
} |
@swapnilkadu What error are you seeing exactly? Do you see any of the |
I am wondering how the above issue of @swapnilkadu fixed? I am having the same issue. Any pointers? |
Comment out the |
This issue arises when calling one request then refreshing the page. I have the code that I have wrote for this if anyone is interested in duplicating it.
http://c9754731.r31.cf2.rackcdn.com/WebServicesServlet_Exam.zip
All you have to do to set this up (I built it and use it on windows so I dont know how it will work on linux lol). You just need to setup the ConnectionConfig.js file in the lib folder with your connection info and then modify the gateway test method.
Any help with this would be greatly appreciated!!!
The text was updated successfully, but these errors were encountered: