Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid consumer tokens, Docker Image #514

Open
BotJames312 opened this issue Jan 24, 2024 · 1 comment
Open

Invalid consumer tokens, Docker Image #514

BotJames312 opened this issue Jan 24, 2024 · 1 comment

Comments

@BotJames312
Copy link

I'm trying run my code on docker, but when i try make 'docker run -p 1000:1000 test' i receive this on Docker Desktop:

/usr/src/app/node_modules/twitter-api-v2/dist/cjs/client-mixins/request-maker.mixin.js:164
            throw new Error('Invalid consumer tokens');
            ^

Error: Invalid consumer tokens
    at ClientRequestMaker.buildOAuth (/usr/src/app/node_modules/twitter-api-v2/dist/cjs/client-mixins/request-maker.mixin.js:164:19)
    at ClientRequestMaker.initializeToken (/usr/src/app/node_modules/twitter-api-v2/dist/cjs/client-mixins/request-maker.mixin.js:121:32)
    at new TwitterApiBase (/usr/src/app/node_modules/twitter-api-v2/dist/cjs/client.base.js:18:32)
    at new TwitterApi (/usr/src/app/node_modules/twitter-api-v2/dist/cjs/client/index.js:14:1)
    at Object.<anonymous> (/usr/src/app/RedesSociais/Client.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)

I execute the code on vs code, and work normally.

@lucas-ohlin
Copy link

Hi, know this is a bit late but it's most likely just a problem with your .env file (if that's what you're using). I had this same issue when I had my .env file outside of the folder I was running a script from.

Let's say I have my .env file in user/project/.env
and I have my script in user/project/scripts/test.js

Then I run cd c:/user/project/scripts/ and then node test.js i'll get this same error as you, that's because the .env file currently isn't a enviroment variable that's being ran since it's "outside" of what i'm trying to run.

But if I were to run cd c:/user/project and then node scripts/test.js it'll run without any issues since it's now an enviroment variable.

Now i'm not the best at explaining since i'm not a naitive english speak so check this out: https://stackoverflow.com/questions/42335016/dotenv-file-is-not-loading-environment-variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants