SOHU-Co / kafka-node

Node.js client for Apache Kafka 0.8 and later.
MIT License
2.66k stars 628 forks source link

Class extends value undefined is not a constructor or null #1464

Open kennethtomagan opened 2 years ago

kennethtomagan commented 2 years ago

Encounter an error. did you guys know what is this error and how to solve this?

Error Log:

app.js:83282 Uncaught TypeError: Class extends value undefined is not a constructor or null
    at ./node_modules/kafka-node/lib/producerStream.js (app.js:83282:30)
    at __webpack_require__ (app.js:219225:42)
    at ./node_modules/kafka-node/kafka.js (app.js:77575:26)
    at __webpack_require__ (app.js:219225:42)
    at ./resources/js/plugins/kafka.js (app.js:50554:13)
    at __webpack_require__ (app.js:219225:42)
    at ./resources/js/app.js (app.js:49904:75)
    at __webpack_require__ (app.js:219225:42)
    at app.js:219395:64
    at __webpack_require__.O (app.js:219262:23)

Code in ./node_modules/kafka-node/lib/producerStream.js (app.js:83282:30) The error point on Writable class.

class ProducerStream extends Writable {

My webpacak.config.js

{
    resolve: {
                alias: { ...},
                fallback:  {
                    "fs": false,
                    "tls": false,
                    "net": false,
                    "path": false,
                    "zlib": false,
                    "stream": false,
                    "crypto": false,
                    "crypto-browserify": require.resolve('crypto-browserify'), //if you want to use this module also don't forget npm i crypto-browserify 
                } 
            },
    module: {
        rules: [...]
},
edubois10 commented 1 year ago

Hi, did you solve your issue by any chance? I have the same with the kafka-node package. I am trying to consume messages from a topic. I am using nuxt3