flightplan-tool / flightplan

Search for award inventory using Node.js and Headless Chrome!
Apache License 2.0
142 stars 41 forks source link

Search Error: SQLite3 can only bind numbers... #10

Closed dday4thedeceiver closed 5 years ago

dday4thedeceiver commented 5 years ago

This happens after the first search on BA site comes up as not available. Similar result with NH so it's not airline specific.

flightplan search 0.2.2
Airline website to search (2-letter code)? BA
Departure city (3-letter code)? STL
Arrival city (3-letter code)? POM
Desired cabin class (first/business/premium/economy)? economy
Start date of search range (YYYY-MM-DD)? 2019-04-01
End date of search range (YYYY-MM-DD)? 2019-07-21
Searching 112 days of award inventory: 2019-04-01 - 2019-07-21
[BA] DEPARTURE [POM -> STL] - 2019-04-01 (1 Passenger)
[BA] info Logging in...
[BA] success Login succeeded
error A fatal error occurred!
TypeError: SQLite3 can only bind numbers, strings, Buffers, and null
    at Object.insertRow (C:\Users\mark\AppData\Local\Yarn\Data\global\node_modules\flightplan-tool\shared\db.js:100:27)
    at Object.saveAwards (C:\Users\mark\AppData\Local\Yarn\Data\global\node_modules\flightplan-tool\shared\utils.js:266:26)
    at main (C:\Users\mark\AppData\Local\Yarn\Data\global\node_modules\flightplan-tool\bin\cli-search.js:318:15)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
jd20 commented 5 years ago

Do you have an old database lying around from the earlier version of flightplan? Try deleting "db" and "data" folders, and run again.

I ran for just 2019-04-01, and both searching and parsing was successful, so pretty certain this is an incompatibility with the old database format.

❯ node bin/cli-search.js -w BA -f STL -t POM -c economy -s 2019-04-01 -e 2019-04-01
Creating database...
Searching 1 days of award inventory: 2019-04-01 - 2019-04-01
[BA] DEPARTURE [POM -> STL] - 2019-04-01 (1 Passenger)
[BA] info Logging in...
[BA] success Login succeeded
[BA] DEPARTURE [STL -> POM] - 2019-04-01 (1 Passenger)
success Search complete!
dday4thedeceiver commented 5 years ago

Strange. I did delete the db, and subsequently data. I did it again for good measure - as you can see below:

flightplan search 0.2.2
Airline website to search (2-letter code)? BA
Departure city (3-letter code)? STL
Arrival city (3-letter code)? NRT
Desired cabin class (first/business/premium/economy)? economy
Start date of search range (YYYY-MM-DD)? 2019-03-01
End date of search range (YYYY-MM-DD)? 2019-06-30
Creating database...
Searching 121.95833333333333 days of award inventory: 2019-03-01 - 2019-06-30
[BA] DEPARTURE [NRT -> STL] - 2019-03-01 (1 Passenger)
[BA] info Logging in...
[BA] success Login succeeded
error A fatal error occurred!
TypeError: SQLite3 can only bind numbers, strings, Buffers, and null
    at Object.insertRow (C:\Users\mark\AppData\Local\Yarn\Data\global\node_modules\flightplan-tool\shared\db.js:100:27)
    at Object.saveAwards (C:\Users\mark\AppData\Local\Yarn\Data\global\node_modules\flightplan-tool\shared\utils.js:266:26)
    at main (C:\Users\mark\AppData\Local\Yarn\Data\global\node_modules\flightplan-tool\bin\cli-search.js:318:15)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Did a 1 day search with your exact command line above, same error.

Some issue with SQLite & Windows?

jd20 commented 5 years ago

Possibly because I run the search / parse commands separately, let me try again.

jd20 commented 5 years ago

Yep, the error is related to running the search command without the --no-parser flag. Debugging it now.

jd20 commented 5 years ago

Fixed with d9d7daceb0364833c72f1540a17cc3e47e940ede in version 0.2.3. Can you upgrade and let me know if it's fixed for you?

dday4thedeceiver commented 5 years ago

Yes, it's fixed. Thanks!