What is the problem?
Some combinations of data lead to the below exception:
/srv/service/node_modules/mariadb/lib/misc/errors.js:61
return new SqlError(msg, sql, fatal, info, sqlState, errno, additionalStack, addHeader);
^
SqlError: (conn=1543, no: 1062, SQLState: 23000) Duplicate entry '0' for key 'behavior'
sql: INSERT INTO behaviors (behavior) VALUES (?); - parameters:[false]
at Object.module.exports.createError (/srv/service/node_modules/mariadb/lib/misc/errors.js:61:10)
at PacketNodeEncoded.readError (/srv/service/node_modules/mariadb/lib/io/packet.js:511:19)
at Query.readResponsePacket (/srv/service/node_modules/mariadb/lib/cmd/resultset.js:46:28)
at PacketInputStream.receivePacketBasic (/srv/service/node_modules/mariadb/lib/io/packet-input-stream.js:104:9)
at PacketInputStream.onData (/srv/service/node_modules/mariadb/lib/io/packet-input-stream.js:169:20)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
text: "Duplicate entry '0' for key 'behavior'",
sql: 'INSERT INTO behaviors (behavior) VALUES (?); - parameters:[false]',
fatal: false,
errno: 1062,
sqlState: '23000',
code: 'ER_DUP_ENTRY'
}Steps to reproduce problem
- Save the JSON from "Reproduction data" below as a .gz file (e.g. behaviours_duplicate_reprod.json.gz) into the ipoid/tmp directory
- If necessary, start up docker in the ipoid directory (e.g. docker compose up -d)
- Initialise the database: docker compose exec web node init-db.js
- Run this command: docker compose exec -e FEED_PATH=./tmp/behaviours_duplicate_reprod.json.gz web node import-data.js
Environment
ipoid commit deed45d61626f952ce8b9365e12e8bd98703fa17
Reproduction data
{"as": {"number": -16121, "Organization": "\u00dd"}, "client": {"behaviors": [false, false, null, "\ud8d2\udc4a", null, 109, 22559, true, 8131, "\u00b0"], "concentration": {}, "count": 4988, "countries": 11367, "proxies": ["\u00e5", null, null, true, false, 5, "\u0093", null], "spread": "\u0084", "types": ["DESKTOP", "HEADLESS", "HEADLESS", "DESKTOP"]}, "infrastructure": -8911, "location": {"state": 6912, "city": false, "country": "\u00b4\u00dd"}, "organization": false, "risks": ["GEO_MISMATCH"], "services": [], "tunnels": [{"anonymous": "\udacf\udc4f", "entries": ["\ud8fc\ude67\u000ex\u0012", null], "operator": 934011972, "type": ""}, {"anonymous": false, "entries": [41633035075126012038491746581005889092, null, null, "g\ud841\udcacZ\u00f8<", true, "R", "\ud997\udc55\ud929\udc3d\u00c9"], "operator": "\u0080", "type": "<\u00e4\u00a1\u00e8"}, {"anonymous": -103, "entries": [], "operator": "\ru\uda6b\udf21\u0082\u00b58\u00efx\u2333\u00d7\u00f5\u0083\ud886\udd00r\u0098\u00f7", "type": ""}], "ip": "fb13ef4c-4a5f-4333-b0a9-fb2ea67ad0ff"}
{"as": {"Organization": "\u00a0", "number": ">"}, "client": {"behaviors": [false, true, 1, 26], "concentration": {"density": null}, "count": true, "countries": true, "proxies": [], "spread": "C", "types": ["HEADLESS", "DESKTOP", "MOBILE", "MOBILE", "MOBILE"]}, "infrastructure": null, "location": {"state": "S", "city": 2, "country": "\u00f8"}, "organization": 112, "risks": ["WEB_SCRAPING", "GEO_MISMATCH"], "services": [-350, "", 32, 1573, -2210, null], "tunnels": [{"anonymous": 18057, "entries": [-15022], "operator": false, "type": true}, {"anonymous": "\u00b4\u001e\udae7\udd569\u00b9", "entries": [], "operator": -1579573877, "type": "\udb29\uddb0"}, {"anonymous": "B", "entries": [], "operator": 2538, "type": "6\u00b6\u0081\u00b7"}, {"anonymous": true, "entries": [], "operator": -762486195, "type": false}, {"anonymous": null, "entries": [null, null, -1457, "*", null, 18831, "\u00fc", true, null, null, null, "\"", "\uda15\udfde\u0005+\u0086\u00d1\ud8b4\udc68d<u\ud952\udcd2|\ud932\ude28", 126, null], "operator": "l", "type": "\u00f0"}], "ip": "45d99abe-cbb9-425a-9603-7f595c737ba4"}