Skip to content

Error: child "id" fails because ["id" must be a string] #171

Open
@therealbenpai

Description

While attempting to create a lobby, I get this error

C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\client.js:178
        const e = new Error(message.data.message);
                  ^

Error: child "id" fails because ["id" must be a string]
    at RPCClient._onRpcMessage (C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\client.js:178:19)
    at IPCTransport.emit (node:events:513:28)
    at C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\transports\ipc.js:138:18
    at decode (C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\transports\ipc.js:92:5)
    at Socket.<anonymous> (C:\Users\USER\Documents\DRPC\node_modules\discord-rpc\src\transports\ipc.js:120:7)
    at Socket.emit (node:events:513:28)
    at emitReadable_ (node:internal/streams/readable:590:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21) {
  code: 4000,
  data: {
    code: 4000,
    message: 'child "id" fails because ["id" must be a string]'
  }
}

heres my code:

const rpc = require("discord-rpc");
const client = new rpc.Client({ transport: 'ipc' });
const config = require('./config.json');
require('dotenv').config();

client.login({ clientId: config.ClientID }).catch(console.error);

client.on('ready', () => {
    console.log('[DEBUG] Presence now active!')
    console.log('[WARN] Do not close this Console as it will terminate the rpc')
    console.log('=================== Error Output ===================')
    client.setActivity({
            details: config.Details,
            state: config.State,
            startTimestamp: Date.now(),
            largeImageKey: config.LargeImage,
            largeImageText: config.LargeImageText,
            smallImageKey: config.SmallImage,
            smallImageText: config.SmallImageText,
            // use an environment variable to set the matchSecret
            matchSecret: process.env.MATCH_SECRET,
            joinSecret: process.env.JOIN_SECRET,
            spectateSecret: process.env.SPECTATE_SECRET,
            partyId: process.env.PARTY_ID,
            partySize: parseInt(process.env.PARTY_SIZE,10),
            partyMax: parseInt(process.env.PARTY_MAX,10),
    })
    const lobby = client.createLobby(2, 12, {
        id: '1234567890',
        secret: '1234567890password',
    }).then((data) => {
    })
    client.connectToLobby(lobby, process.env.LOBBY_SECRET)
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions