question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Channel not found error when running without Firebase keys

See original GitHub issue

I was trying to set up EddieBot locally without the Firebase keys.

  1. I disabled the Firebase errors by commenting out these lines:
./node_modules/firebase-admin/lib/auth/credential.js:134
./node_modules/firebase-admin/lib/auth/credential.js:142
  1. Then I filled up ./.env like this:
DISCORD_TOKEN=<token of my bot in single quotes>
COMMAND_PREFIX="^"
# You can find this from "right clicking" on your server and selecting "Copy ID".
DISCORD_SERVER_ID=<my server token in single quotes>
# You can use ANY channel by "right clicking" on your server and selecting "Copy ID". A #bot channel is recommended.
DISCORD_BOT_CHANNEL_ID=<token on the #bot channel in my server in single quotes>
# Generate a firebase service account in the UI, the `gcloud` CLI will generate you the wrong service account.
# When you download your Firebase service account details, these will be in the downloaded/generated json file.
FIREBASE_PRIVATE_KEY=""
FIREBASE_PROJECT_ID=""
FIREBASE_CLIENT_EMAIL=""
FIREBASE_DATABASE_URL=""
  1. Now when I try to run the bot, this is what I face:
❯ npm run start:local

> eddiebot@1.0.0 start:local /home/raisinten/Desktop/universe/git/EddieBot
> npm run build && node dist/index.js


> eddiebot@1.0.0 build /home/raisinten/Desktop/universe/git/EddieBot
> tsc

[1601308601188] INFO  (504 on hp): Scheduling the job opensource-reminder
[1601308601192] ERROR (504 on hp): Channel not found
(node:504) UnhandledPromiseRejectionWarning: Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.
    at WebSocketManager.createShards (/home/raisinten/Desktop/universe/git/EddieBot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:260:15)
(node:504) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:504) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^C


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
alrifaycommented, Sep 30, 2020

Do you know what the reason is behind that error? I tried few commands on my channel and it produced the correct responses.

The reason you get this error is either you didn’t set the correct bot channel id in .env file https://github.com/EddieJaoudeCommunity/EddieBot/blob/2c8adb209b1b397914025cd4f0f595743e7b4654/.env.example#L5-L6

or because scheduleOpenSourceReminder in index.ts starts executing and logging to the bot channel before the bot is ready.

To fix it, move scheduleOpenSourceReminder on index.ts:41 https://github.com/EddieJaoudeCommunity/EddieBot/blob/2c8adb209b1b397914025cd4f0f595743e7b4654/src/index.ts#L41 to index.ts:16 so it start executing when the bot is ready. https://github.com/EddieJaoudeCommunity/EddieBot/blob/2c8adb209b1b397914025cd4f0f595743e7b4654/src/index.ts#L14-L16

2reactions
alrifaycommented, Sep 30, 2020

Do you think I should make a pr with this change?

Of course, PRs are always welcome 🎉

I just tried what you mentioned but it still produced the same error.

I’m curious to know why it didn’t work for you, could you show me what you did and didn’t work 😁 Because I tried the example

client.once('ready', () => {
    log.info('Online!', 'Lets get started...');
    scheduleOpenSourceReminder();
    if (client.user) {
        client.user.setPresence({
            activity: {
                name: `${config.COMMAND_PREFIX}help for help`,
                type: 'WATCHING',
            },
            status: 'online'
        });
    }
});

and it worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Admin Authentication API Errors | Firebase - Google
Admin Authentication API Errors ; auth/project-not-found, No Firebase project was found for the credential used to initialize the Admin SDKs.
Read more >
Error Messages | Maps JavaScript API - Google Developers
Once you have located your project in the Cloud Console, check if a billing account is attached by navigating to the Billing section...
Read more >
Authenticate using API keys - Google Cloud
API-first integration to connect existing data and applications. ... Solution to bridge existing care systems and apps on Google Cloud. ... No-code development ......
Read more >
Android: Firebase Credentials - OneSignal Documentation
A Google Firebase Server Key is required for all Android mobile apps and Chrome app extensions. It is optional for Amazon apps. What...
Read more >
Error: Could not find the correct Provider<User> above this ...
I'm getting this error when running my Flutter app and I have no clue about how to fix it. I suspect that the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found