Closed ghost closed 4 years ago
I'm using node 10
I believe the error is occurring because in transaction the "args" is an array of array, then it fails here:
typeof args[0] === 'string' ? args[0]
: typeof args[0] === 'object' && typeof args[0].sql === 'string' ? args[0].sql
: error('No \'sql\' statement provided.')
Thanks for the report @engfilipe. I'll investigate this.
I had the same issue while using transactions. After investigating, found that args
was coming in as Nested array in code.
const query = async function(config,...args) {
Flattening the array with the below code will work for both transactions and queries.
const query = async function(config,..._args) {
var args = [].concat.apply([], _args);
...
Not sure about batches since there is a comment that says Deprecated this since it was collapsing batches
. Any suggestion on how do we use it for transactions without getting sql
error.
I see the problem here. I removed the flattening because it was causing an issue with something else, but it looks like I'll need to add it back in and make it conditional somehow. Thanks for catching this!
Fixed in v1.0.1.
Hello,
After updating to version 1.0.0 (I was using beta) this error occurs when I try to make a transaction:
No 'sql' statement provided. at error (/var/task/build/node_modules/data-api-client/index.js:54:35) at parseSQL (/var/task/build/node_modules/data-api-client/index.js:60:5) at Object.query (/var/task/build/node_modules/data-api-client/index.js:303:15) at commit (/var/task/build/node_modules/data-api-client/index.js:421:30) at process._tickCallback (internal/process/next_tick.js:68:7)