Skip to content

Query function is actually called 3 times in express #57

@ghost

Description

Hi there,

I've a weird issue there :

router.get("/list/", async (req, res, next) => {
  let promise = new Promise(function(resolve, reject) {
      db.query(queries.LIST, parameters, (err, rows, moreResultSets) => {
        if (err) {
          reject(err);
        } else {
          resolve(rows);
        }
      });
    });
    let result = await promise;
    res.status(200).send(result);
  });

The db.query function is somehow called 2 times and I don't know why exactly.

The first time it return an empty array, the second time the good one.

I'm using Express and it causes a lot of issues with res.send.

Thanks for the help 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions