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

TypeError: Cannot read property 'toLowerCase' of undefined #393

Open
5HuseyinYildirim opened this issue Dec 19, 2020 · 3 comments
Open

TypeError: Cannot read property 'toLowerCase' of undefined #393

5HuseyinYildirim opened this issue Dec 19, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@5HuseyinYildirim
Copy link

Sometimes(every 2-3 weeks) I get an error like this and this error restarts all Clusters:

/root/bot/node_modules/kurasuta/dist/IPC/MasterIPC.js:33
        this[`_${Constants_1.IPCEvents[op].toLowerCase()}`](message);
                                           ^

TypeError: Cannot read property 'toLowerCase' of undefined
    at MasterIPC._incommingMessage (/root/bot/node_modules/kurasuta/dist/IPC/MasterIPC.js:33:44)
    at Server.emit (events.js:315:20)
    at ServerSocket._onData (/root/bot/node_modules/veza/dist/lib/ServerSocket.js:100:33)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)

And I am also having "JavaScript heap out of memory" issues in shard file. It may be relevant to me. Are there any problems with this file?

const { ShardingManager } = require('kurasuta');
const { join } = require('path');
const { WebhookClient } = require("discord.js");
const ayarlar = require('./ayarlar.json')
const sharder = new ShardingManager(join(__dirname, 'bot'), {
  token: ayarlar.token,
  guildsPerShard: 1500,
  clusterCount: 4,
  clientOptions: {
    retryLimit: Infinity,
    presence: { activity: { name: '+yardım', type: "WATCHING" }, status: 'online' },
    messageCacheMaxSize: 20,
    messageCacheLifetime: 600,
    messageSweepInterval: 300
  },
  timeout: 60000
});

const webhook = new WebhookClient(ayarlar.shardWebhook.ID, ayarlar.shardWebhook.TOKEN);
const clusterWebhook = new WebhookClient(ayarlar.clusterWebhook.ID, ayarlar.clusterWebhook.TOKEN);

sharder.on("debug", console.log)
.on('ready', async(cluster) => {
  clusterWebhook.send(`\`${cluster.id+1}.\` Cluster aktif oldu.`)
})
.on('shardReady', async(shard) => {
  webhook.send(`\`${shard+1}.\` Shard aktif oldu.`)
})
.on('shardReconnect', async(shard) => {
  webhook.send(`\`${shard+1}.\` Shard yeniden bağlanmaya çalışıyor.`)
})
.on('shardResume', async(replay, shard) => {
  webhook.send(`\`${shard+1}.\` Shard yeniden bağlandı.`)
})
.on('shardDisconnect', async(event, shard) => {
  webhook.send(`\`${shard+1}.\` Shard bağlantısını kesti.
\`\`\`diff
- ${event}
\`\`\``)
})
.on('error', async() => {
  return undefined
})

sharder.spawn().catch(err => {
  console.error("Shardlar başlatılırken bir sorun oluştu.", err)
})
@varedz
Copy link

varedz commented Jan 23, 2021

Just encountered the
"TypeError: Cannot read property 'toLowerCase' of undefined"
a couple minutes ago.
https://cdn.discordapp.com/attachments/777679944163131392/802655366717374474/unknown.png
Will try to fix it myself in the meantime, although sounds like something to be fixed soon for 2.2.1 @DevYukine

As far as your JavaScript heap out of memory, are you sure you're just not running out of memory? Keep an eye on how much memory usage you're using and how much is being allocated for those processes.

@DevYukine
Copy link
Owner

The JavaScript heap out of memory is most likely not a Kurasuta issue since i run it in prod since quite some time without issues myself

TypeError: Cannot read property 'toLowerCase' of undefined seems to be an underlying issue by veza emitting wrong data 🤔 i will investigate that

@DevYukine DevYukine added the bug Something isn't working label Feb 3, 2021
@varedz
Copy link

varedz commented Feb 24, 2021

image

@DevYukine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants