Open jasonbert opened 5 years ago
The error means: pg-promise received a request from Massive.js that's not a real query, possibly a null
, undefined
or an empty string. In other words, at some point Massive.js failed to prepare a valid query, but still tried to execute it via pg-promise, which in turn threw the error.
Thanks for shedding some light on the potential issue, however I'm not sure where a query like that would be coming from?
There it says in the error:
node_modules\demux-postgres\dist\MassiveActionHandler.js:97:23
It is doing there something that makes Massive.js execute an empty or missing query.
Still digging into this issue, but it appears to be because of the Cyan Audit SQL file that needs to be run. In the generic pg-promise $query
function there's a check to see if the query is a string, but in this case the variable is an object.
Looks like PG Promise isn't able to work out what to do with that query file and therefore doesn't change the query
object in the actual query string.
Looks like this is a duplicate of issue https://github.com/EOSIO/demux-js-postgres/issues/67
Yes, but from what I said above, you are looking at too deep. The issue is above pg-promise where such an invalid object gets passed in through Massive.js somehow, an object that does not represent a valid query. pg-promise correctly throwing on it is just the final consequence of it, as the higher layers fail to handle the situation.
Just to be clear, I haven't said pg-promise is the problem ;). And looking this deep led me to the same issue someone else faced.
Added comments to closed issue #67, but reopening this one as it's closed. I had to remove .default
in the generated index.js
file for the module. There's no default
property when you do require('massive')
as that exports the default and is then in massive_1
. Obviously this isn't a fix and needs to be corrected in the TypeScript file https://github.com/EOSIO/demux-js-postgres/blob/develop/src/index.ts
Someone has kindly made a PR to fix this issue :)
I'm receiving the
TypeError: Invalid query format.
error when myinit
migration is run. The setup prior to that has created tables in Postgres, so it's definitely able to do some queries.index.js
migrationSequences/index.js
migrationSequences/createTables.sql