Discord.js: Cannot read property 'handle' of undefined on all minified webpack builds

Created on 26 Aug 2017  路  17Comments  路  Source: discordjs/discord.js

Sorry, I accidentally press the Enter key to post issues. Please wait for finish writing. Thank you.
_The original issue was solved, so please read the message below_

webpack medium gateway bug

Most helpful comment

still happening on discord.js 11.3.0

All 17 comments

Feel free to use 11.1-dev in the webpack branch, everything works correctly there.
I'm not sure what exactly is wrong with 11.1.0, since it also doesn't throw an error. It just stops at identifying with the gateway. So this needs a bit more investigation.

11.1-dev works correctly though.

Thank you.

I tried discord.11.1-dev.js and discord.11.1-dev.min.js.

Both are Client.user is null.
and min.js get error Cannot read property 'handle' of undefined.

Uncaught TypeError: Cannot read property 'handle' of undefined
    at s.handle (discord.11.1-dev.min.js:1)
    at r.handle (discord.11.1-dev.min.js:1)
    at h.onPacket (discord.11.1-dev.min.js:1)
    at h.onMessage (discord.11.1-dev.min.js:1)

What browser are you using?

The latest version Google Chrome

I tested this on Chrome Version 62.0.3192.0 (Official Build) dev (64-bit) dev
and Version 60.0.3112.113 (Official Build) (64-bit) stable

And it works perfectly fine with discord.11.1-dev.min.js

Can I see your code?

Sorry, I forgot to await ready event.

The original issue was solved,
but I confirmed Cannot read property 'handle' of undefined error in min.js.

Uncaught TypeError: Cannot read property 'handle' of undefined
    at r.handle (discord.11.1-dev.min.js:1)
    at r.handle (discord.11.1-dev.min.js:1)
    at h.onPacket (discord.11.1-dev.min.js:1)
    at h.onMessage (discord.11.1-dev.min.js:1)

This seems to be an issue with the minified file.

I cannot reproduce this on 11.1-dev though. Only on 11.1-dev.min

Noted with thanks.

This should be finally fixed now. All minified webpacks have been updated 馃憤

still happening on discord.js 11.3.0

This is happening on 11.4.2:

TypeError: Cannot read property 'handle' of undefined
    at t.exports.handle (/srv/index.js:1:396342)
    at t.exports.handle (/srv/index.js:1:382627)
    at l.onPacket (/srv/index.js:1:377444)
    at l.onMessage (/srv/index.js:1:376836)
    at v.n (/srv/index.js:1:414974)
    at emitOne (events.js:116:13)
    at v.emit (events.js:211:7)
    at t.exports._receiver.onmessage.t [as onmessage] (/srv/index.js:1:403076)
    at t.exports.dataMessage (/srv/index.js:1:422707)
    at t.exports.getData (/srv/index.js:1:421963)

Yes, this most likely won't be fixed until we release a new version.

Use https://github.com/discordjs/discord.js/blob/webpack/discord.11.4-dev.min.js instead.

It is non-breaking to the current stable release.

I'm hitting this same issue on 11.5.1 - all prod builds by webpack fail and I have to use a development bundle

so is there any progress on this issue? I too encountered this issue on 11.5.1

As a workaround, set keep_classnames: true in your terser options.

new TerserPlugin({
    terserOptions: {
        keep_classnames: true
    }
})

Just came across this issue trying to run on a production build, development works fine, version 12.2.0.
Workaround mentioned above had no effect.

Was this page helpful?
3 / 5 - 1 ratings

Related issues

ghost picture ghost  路  3Comments

LLamaFTL picture LLamaFTL  路  3Comments

Dmitry221060 picture Dmitry221060  路  3Comments

kvn1351 picture kvn1351  路  3Comments

Acaretia picture Acaretia  路  3Comments