sql operator automatically inserts wrong json quotes around expression

const sqlString = sql`select * from ${workflows} w where JSON_CONTAINS(w.definition, '{ "data": { "formId": "${formId}", "type": "form_submission" }}', '$.nodes')`;

With this I get the following error
"sql": "select * from `workflows` w where JSON_CONTAINS(w.definition, '{ \"data\": { \"formId\": \"'HUkAEH1LUD'\", \"type\": \"form_submission\" }}', '$.nodes')",
      "sqlState": "42000",
      "sqlMessage": "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 ''\", \"type\": \"form_submission\" }}', '$.nodes')' at line 1"

When I try the same without the expression it works as expected and I get some rows as a result.
const sqlString = sql`select * from ${workflows} w where JSON_CONTAINS(w.definition, '{ "data": { "formId": "ASADA7898ASD", "type": "form_submission" }}', '$.nodes')`;
Was this page helpful?