Closed Spaceface16518 closed 6 years ago
After adding in some line-by-line checkpoints (commit 8bd2c9a) test results show that checkpoint number 13 was not reached before the error was thrown. Checkpoint 12 also fired before the error was thrown. In this sense I have isolated the error to be in the command
node app.js
In the error text there were references to missing credentials. Here is the full error statement:
Error: Missing credentials passed to snoowrap constructor. You must pass an object containing
either (a) userAgent, clientId, clientSecret, and refreshToken properties, (b) userAgent and
accessToken properties, or (c) userAgent, clientId, clientSecret, username, and password
properties. For information, please read the docs at https://not-an-aardvark.github.i
/snoowrap/.
at new snoowrap (/Users/AMRIT/GitHub/strat-collector/node_modules/snoowrap/dist/snoowrap.js:151:13)
at Object.<anonymous> (/Users/AMRIT/GitHub/strat-collector/app.js:10:12)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:193:16)
at bootstrap_node.js:617:3
As you can see, there is a lot of references to credentials. This got me thinking. Since the collector env cofigure module has not yet been configured, the app can't really work. It requires (not node require, english require) an env file containing environmental variables so that the bot knows where to look for these reddit posts and the sort. Since the nature of open source code is public, it is unsafe to commit credentials. Therefore, when local testing, you must include an environmental folder in the app. As soon as I connect the two modules (or maybe integrate them rather than having them as two separate repos) the first testing release can happen. This program is almost finished, it just needs a little push :).
In summary, the error was not with the script, but with the JavaScript file itself. Code kept calling env variables that didn't exist. You must add a env file before locally testing until the env-configure module is connected.
While executing routine local tests, I encountered a problem in
launch.js
. For whatever reason, local tests seem to be breaking at this point. The line saysIt's nothing special, and it is not something simple like "I'm not
build
ing my code before Ilaunch
it".