medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
22 stars 25 forks source link

Error: Cookie has domain set to the public suffix "localhost" which is a special use domain. #587

Open kennsippell opened 11 months ago

kennsippell commented 11 months ago

Describe the bug Its a crash

To Reproduce

  1. npx cht --local

Expected behavior Should be able to deploy locally

Logs

INFO Starting action: backup-all-forms… 
INFO Error: Cookie has domain set to the public suffix "localhost" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}.
    at Object.getPublicSuffix (/home/kenn/config-echis-2.0/node_modules/tough-cookie/lib/pubsuffix-psl.js:62:11)
    at permuteDomain (/home/kenn/config-echis-2.0/node_modules/tough-cookie/lib/permuteDomain.js:38:28)
    at MemoryCookieStore.findCookies (/home/kenn/config-echis-2.0/node_modules/tough-cookie/lib/memstore.js:99:21)
    at MemoryCookieStore.findCookies (/home/kenn/config-echis-2.0/node_modules/universalify/index.js:5:67)
    at CookieJar.getCookies (/home/kenn/config-echis-2.0/node_modules/tough-cookie/lib/cookie.js:1410:11)
    at CookieJar.getCookies (/home/kenn/config-echis-2.0/node_modules/universalify/index.js:5:67)
    at CookieJar.getCookieString (/home/kenn/config-echis-2.0/node_modules/tough-cookie/lib/cookie.js:1455:21)
    at CookieJar.getCookieString (/home/kenn/config-echis-2.0/node_modules/universalify/index.js:5:67)
    at node:internal/util:364:7
    at new Promise (<anonymous>)
    at bound getCookieString (node:internal/util:350:12)
    at fetchCookie (/home/kenn/config-echis-2.0/node_modules/fetch-cookie/index.js:15:26)
    at ourFetch (/home/kenn/config-echis-2.0/node_modules/pouchdb-adapter-http/lib/index.js:218:12)
    at fetchJSON (/home/kenn/config-echis-2.0/node_modules/pouchdb-adapter-http/lib/index.js:246:12)
    at setup (/home/kenn/config-echis-2.0/node_modules/pouchdb-adapter-http/lib/index.js:294:20)
    at PouchDB.HttpPouch.api.fetch (/home/kenn/config-echis-2.0/node_modules/pouchdb-adapter-http/lib/index.js:467:12) 
ERROR Cookie has domain set to the public suffix "localhost" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}. 

Environment

Additional context Kenya eCHIS local testing

kennsippell commented 11 months ago

Workaround is to use 127.0.0.1 instead of localhost

kennsippell commented 8 months ago

Also manifests as

INFO Error: Unable to fetch xml attachment of doc with id xxx, returned status code = undefined
    at Object.preUploadForm (/home/kenn/config-echis-2.0/node_modules/cht-conf/src/lib/warn-upload-overwrite.js:199:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async execute (/home/kenn/config-echis-2.0/node_modules/cht-conf/src/lib/upload-forms.js:91:21)
    at async module.exports (/home/kenn/config-echis-2.0/node_modules/cht-conf/src/lib/main.js:193:5)
    at async /home/kenn/config-echis-2.0/node_modules/cht-conf/src/bin/index.js:16:5