latitude-dev / latitude

Developer-first embedded analytics
https://latitude.so
GNU Lesser General Public License v3.0
626 stars 21 forks source link

Query file not found || Connector not installed #348

Closed abgonzalez93 closed 2 weeks ago

abgonzalez93 commented 2 weeks ago

Environment

Actual Behaviour

After updating CLI and Latitude project to the newest versions and also, installing MySQL Connector with the following command

npm install --save @latitude-data/mysql-connector

I found new 2 errors on my project:

imagen

imagen

imagen

imagen

geclos commented 2 weeks ago

hey @abgonzalez93

Let's look at the 2 issues separately.

Connector not installed

The watchers detect if the package is installed via the package.json that should be present in the root of your project. Could you confirm you have a package.json at the root of your project and that it has the mysql connector listed in the dependencies list? If not, please do add a package.json and run the npm install --save ... connector from the root of your project

Query not found

The behaviour looks correct so I'm not sure what could be happening here. latitude dev keeps the contents of the queries folder in sync with the contents of .latitude/app/static/.latitude/queries folder. I'm gonna try to reproduce the issue on my end and come back to you.

abgonzalez93 commented 2 weeks ago

imagen

I wonder if dependencies should be inside .latitude/app folder or in the root of my Latitude project, which is this case.

geclos commented 2 weeks ago

Root of the project is where the connectors should be installed, so it looks ok. Some more questions then, are you running latitude dev from the terminal in the root of your project?

abgonzalez93 commented 2 weeks ago

I'm always running latitude dev command in the root of my project

imagen

geclos commented 2 weeks ago

Ok looks good. I've been able to reproduce the query not found issue and will release a fix asap (today). In the meantime if this is critical i'd suggest to downgrade to a previous latitude version with latitude update.

abgonzalez93 commented 2 weeks ago

There is also an error in the previous version (1.0.1). It seems it's because of the MySQL connector:

/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/protocol/Parser.js:437 throw err; // Rethrow non-MySQL errors ^

TypeError: Cannot read properties of undefined (reading 'map') at MysqlConnector.buildQueryParams (file:///home/antoniobueno/Analitica/fieldeas-demo/node_modules/@latitude-data/mysql-connector/dist/index.js:91:23) at file:///home/antoniobueno/Analitica/fieldeas-demo/node_modules/@latitude-data/mysql-connector/dist/index.js:34:50 at Handshake.onConnect (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/Pool.js:64:7) at Handshake. (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/Connection.js:526:10) at Handshake._callback (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/Connection.js:488:16) at Sequence.end (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24) at Sequence.OkPacket (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/protocol/sequences/Sequence.js:92:8) at Protocol._parsePacket (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/protocol/Protocol.js:291:23) at Parser._parsePacket (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/protocol/Parser.js:433:10) at Parser.write (/home/antoniobueno/Analitica/fieldeas-demo/node_modules/mysql/lib/protocol/Parser.js:43:10)

Node.js v18.20.2

geclos commented 2 weeks ago

this is probably some incompatibility with the version of the connector you installed and the version of latitude you are trying to use. It will get fix as soon as I fix the original issue and you can get to using the latest version of latitude. PR is already opened.

geclos commented 2 weeks ago

@abgonzalez93 the patch is released if you could update cli and latitude project to latest versions the issue should be solved 🙏🏼

abgonzalez93 commented 2 weeks ago

Everything working fine now. We keep in touch!