marklagendijk / node-toogoodtogo-watcher

Node.js cli tool for monitoring your favorite TooGoodToGo businesses. Docker image available.
MIT License
363 stars 116 forks source link

v3.10.2 and later: TypeError: Expected value which is `predicate returns truthy for any value`, received values of types `undefined`. #214

Closed sebastianklein96 closed 1 year ago

sebastianklein96 commented 1 year ago

First of all, thanks for the Datadome fixes.

When creating a docker container using v3.10.2 and later, the following error occurs on startup and the container stops:

file:///home/node/app/node_modules/@sindresorhus/is/dist/index.js:305
throw new TypeError(`Expected value which is \`${description}\`, ${valuesMessage}.`);
^

TypeError: Expected value which is `predicate returns truthy for any value`, received values of types `undefined`.
at assertType (file:///home/node/app/node_modules/@sindresorhus/is/dist/index.js:305:15)
at Object.any (file:///home/node/app/node_modules/@sindresorhus/is/dist/index.js:406:36)
at set prefixUrl [as prefixUrl] (file:///home/node/app/node_modules/got/dist/source/core/options.js:582:16)
at Options.merge (file:///home/node/app/node_modules/got/dist/source/core/options.js:411:27)
at got.extend (file:///home/node/app/node_modules/got/dist/source/create.js:82:25)
at file:///home/node/app/lib/gotify.js:4:17
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Node.js v18.14.2

I am mapping the config directory containing a valid config.json, otherwise I'm having default settings for the container. As soon as I downgrade back to 3.10.0 the container starts up no issue and watching is resumed.

sebastianklein96 commented 1 year ago

Looked a little further and the main exception is referenced in this issue of got:

https://github.com/sindresorhus/got/issues/1257

The version of got was updated from ^11.8.2 to ^12.5.3 in https://github.com/marklagendijk/node-toogoodtogo-watcher/commit/556dea136782bed699f617803b912dc291353e9c. Could this be the cause?

marklagendijk commented 1 year ago

Yes, that is related. The stacktrace says the issue is with the gotify notifications.

Maybe your configured gotify.url or gotify.apptoken has an issue?

const api = got.extend({
  prefixUrl: config.get("notifications.gotify.url"),
});
sebastianklein96 commented 1 year ago

Thanks for the info - I don't have gotify configured though. As in, I don't have the gotify block in the config.json. Is the empty configuration block needed for the application to run?

sebastianklein96 commented 1 year ago

Added the configuration blocks from the default config json and filled in relevant information, left everything else disabled. Application now runs.