DatabaseSync::ApplyChangeset() in node_sqlite.cc initializes context.filterCallback by a lambda that captures filterFunc by reference. filterFunc is defined in a block that ends before the callback is invoked (via sqlite3changeset_apply()). So, filterFunc is a dangling reference by that time. The lamda should capture filterFunc by value (compare with the correct capture of context.conflictCallback lambda few lines above).