not-an-aardvark / snoowrap

A JavaScript wrapper for the reddit API
MIT License
1.01k stars 125 forks source link

NoCredentialsError: Missing credentials passed to snoowrap constructor #356

Closed pgiro closed 2 years ago

pgiro commented 2 years ago

I have been using snoowrap for about half a year with no issue, when today my code refused to compile due to the below error

NoCredentialsError: 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.io/snoowrap/.

Which is confusing because (1) it worked before and (2) I am passing an object with userAgent, clientId, clientSecret and refreshToken to the constructor like so (have also tried newing up 'Snoowrap' instead of 'snoowrap')

const redditRequestor: Snoowrap = new snoowrap({
  userAgent: 'User Agent Name',
  clientId: process.env.REDDIT_CLIENT_ID,
  clientSecret: process.env.REDDIT_CLIENT_SECRET,
  refreshToken: process.env.REDDIT_REFRESH_TOKEN
})
Venefilyn commented 2 years ago

If nothing has changed with the constructor code, have you checked the env values?

pgiro commented 2 years ago

In the least satisfying of possibilities, it compiles today no problem... Not sure what the issue was but will close