jeremydaly / data-api-client

A "DocumentClient" for the Amazon Aurora Serverless Data API
MIT License
446 stars 63 forks source link

INSERT with parameters fails if less than 3 parameters #78

Open wallisch opened 3 years ago

wallisch commented 3 years ago

I've just encountered a very strange bug, which took me hours to figure out.

Apparently, if you execute an INSERT statement with parameters, it only works if the passed object contains more than 2 properties.

Fails with "cannot find parameter color_id";

dataAPI.query(
        `INSERT INTO component (color_id, name) 
        VALUES(:color_id, :name)` ,{ 
            color_id: 1,
            name: "test"
})

Passes:

dataAPI.query(
        `INSERT INTO component (color_id, name) 
        VALUES(:color_id, :name)` ,{ 
            color_id: 1,
            name: "test",
            dummy: "dummy"
})

Unfortunately I have no idea what causes this.

ffxsam commented 3 years ago

@jeremydaly This is probably a semi-critical bug. It was fixed in PR #75 but hasn't been published to the npm registry, looks like.

lucas-subli commented 3 years ago

+1

Why is this not on NPM yet?