Skip to content
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

[Bug]: [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client #36

Open
chandrevdw31 opened this issue Jun 12, 2023 · 0 comments

Comments

@chandrevdw31
Copy link

User receiving error while using mindsdb js sdk

Slack Thread:https://mindsdbcommunity.slack.com/archives/C01S2T35H18/p1683968010509909

Query executed:
app.get("/status", async function (req, res) {
// Connect to MindsDB Cloud service
const userEmail = process.env.MINDSDB_USER_EMAIL;
const userPassword = process.env.MINDSDB_USER_PASSWORD;
try {
await MindsDB.default.connect({
user: userEmail,
password: userPassword,
});
const {
gender,
ssc_percentage,
hsc_percentage,
degree_percentage,
emp_test_percentage,
ssc_board,
hsc_board,
hsc_subject,
undergrad_degree,
work_experience,
specialisation,
} = req.query;
const query = SELECT status FROM mindsdb.job_placement_status_predictor WHERE gender=${gender} AND ssc_percentage=${ssc_percentage} AND hsc_percentage=${hsc_percentage} AND degree_percentage=${degree_percentage} AND emp_test_percentage=${emp_test_percentage} AND ssc_board=${ssc_board} AND hsc_board=${hsc_board} AND hsc_subject=${hsc_subject} AND undergrad_degree=${undergrad_degree} AND work_experience=${work_experience} AND specialisation=${specialisation} ;

const repsonse = await MindsDB.SQL.runQuery(query);
if (queryResult.rows.length > 0) {
  console.log(repsonse);
  res.send(repsonse);
}

} catch (error) {
console.log(error);
res.json({ Error: error });
}
});

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant