You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unclear why, but there's some bizarre issue in Node where awaiting a fetch changes the behavior of unrelated code later on. In this case it's causing intoContentBlocking to return an object with fields that are undefined.
import{FilterSet,FilterFormat,RuleTypes}from'adblock-rs'import{readFileSync}from'fs'// This line causes the returned fields from `intoContentBlocking` to be `undefined`.// Everything works as expected when it's commented out.awaitfetch("https://easylist-downloads.adblockplus.org/liste_ar.txt").then(r=>r.text())// ...even though we're using rules from disk (the fetch result is unused).letrules2=readFileSync('./Liste_AR.txt','utf8').trim().split('\n')constfilterSet=newFilterSet(true)filterSet.addFilters(rules2,{format: FilterFormat.STANDARD,rule_types: RuleTypes.NETWORK_ONLY})const{ contentBlockingRules, filtersUsed }=filterSet.intoContentBlocking()// logs `undefined undefined`console.log(typeofcontentBlockingRules,typeoffiltersUsed)
There's some weird dependency between the rules used and the network request (I can't reproduce it using localhost or my personal website). Based on some poking around at this code, my guess is that the issue exists somewhere in neon-serde, although the fact that the fetch is able to affect the later operations smells like a node bug.
The text was updated successfully, but these errors were encountered:
Unclear why, but there's some bizarre issue in Node where awaiting a
fetch
changes the behavior of unrelated code later on. In this case it's causingintoContentBlocking
to return an object with fields that areundefined
.package.json
index.js
There's some weird dependency between the rules used and the network request (I can't reproduce it using
localhost
or my personal website). Based on some poking around at this code, my guess is that the issue exists somewhere inneon-serde
, although the fact that thefetch
is able to affect the later operations smells like anode
bug.The text was updated successfully, but these errors were encountered: