vendure-ecommerce / vendure-plus-issues

Report issues on Vendure Plus plugins here
0 stars 1 forks source link

Advanced Search Plugin: Analytics with MySQL throws `error in your SQL syntax` #33

Open martijnvdbrug opened 3 months ago

martijnvdbrug commented 3 months ago
  1. Install the Advanced Search Plugin
  2. Configure the analyticsStrategy: new SqlAnalyticsStrategy(),
  3. Go to Dashboard > Analytics and then the Event Log tab
  4. See error:
    [Vendure Server] ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? AND `e`.`createdAt` <= ?)
           ) as t3
           ORDER BY time DESC
    ' at line 4
    QueryFailedError: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? AND `e`.`createdAt` <= ?)
           ) as t3
           ORDER BY time DESC
    ' at line 4
    at Query.<anonymous> (/home/martijn/git/huidpraktijkshop/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:165:37)
    at Query.<anonymous> (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/Connection.js:526:10)
    at Query._callback (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/Connection.js:488:16)
    at Sequence.end (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
    at Query.ErrorPacket (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/protocol/sequences/Query.js:92:8)
    at Protocol._parsePacket (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/home/martijn/git/huidpraktijkshop/node_modules/mysql/lib/Connection.js:88:28) 

image

We haven't logged any searches yet, so there are no events in our DB.

michaelbromley commented 3 months ago

Hi,

Thanks for the report. Do you know if this error goes away once there is some data in the events table?

martijnvdbrug commented 3 months ago

Hi,

Thanks for the report. Do you know if this error goes away once there is some data in the events table?

Good question, haven't tested that yet. We currently query Typesense directly, skipping any analytics, but we will start querying via Vendure soon.