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 'write' of null #337

Open
2M4U opened this issue May 29, 2021 · 0 comments
Open

TypeError: Cannot read property 'write' of null #337

2M4U opened this issue May 29, 2021 · 0 comments

Comments

@2M4U
Copy link

2M4U commented May 29, 2021

(node:14840) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null
    at IPCTransport.send (C:\Users\CG\Desktop\Github\Buttons\node_modules\discord-rpc\src\transports\ipc.js:155:17)
    at C:\Users\CG\Desktop\Github\Buttons\node_modules\discord-rpc\src\client.js:166:22
    at new Promise (<anonymous>)
    at RPCClient.request (C:\Users\CG\Desktop\Github\Buttons\node_modules\discord-rpc\src\client.js:164:12)
    at buttons (C:\Users\CG\Desktop\Github\Buttons\lib\functions\buttons.js:5:12)
    at loopStatus (C:\Users\CG\Desktop\Github\Buttons\lib\functions\requests.js:13:9)
    at Object.<anonymous> (C:\Users\CG\Desktop\Github\Buttons\status.js:16:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14840) 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:14840) [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.

CODE

  client.request('SET_ACTIVITY', {
        pid: process.pid,
        activity: {
            assets: {
                large_image: config.assets.image_key,
                large_text: config.assets.image_text,
            },
            buttons: [
                { label: config.button_one.label_name, url: config.button_one.label_url },
                { label: config.button_two.label_name, url: config.button_two.label_url },
            ],
            instance: config.instance || true
        },
    });

    client.on('ready', async () => {
        console.log(`${client.user.username}#${client.user.discriminator}'s presence has updated.`)
    });

    client.login({ clientId: config.client_id }).catch(console.error);```
A-F-Kay added a commit to A-F-Kay/discord-vscode that referenced this issue Aug 12, 2021
I have infinite "Encountered following error while trying to login: Error: Could not connect" errors while trying to use the extension. And I don't get "Reconnect to Discord" text in status bar icon + error message in the bottom right corner. As I figured there is a problem inside of rpc.destroy() or in it's usage.

So I moved rpc.destroy() call+await to end of catch block to make important actions happen before struck.

I don't know the library for very much but I think it may help. Up to you, iCrawl.

P.S. Particullar error what gives me login attempt is simillar to this one discord/discord-rpc#337 . Trouble inside of rpc library? Should I try older version of your extension? Thank you
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

1 participant