Skip to content

Uncaught TypeError: response.setEncoding is not a function #961

Description

@jstoeffler

Hi,

I tried to install socket.io-client in a meteor app, it seems that browserify is responsible (see this issue), but I'm posting this here, because I believe other could have the same issue (and in case someone knows a better fix). Feel free to close the issue if you find it appropriate.

So my app crashes there, it's in the node-XMLHttpRequest (the repository doesn't accept issues), which is required by engine.io, which itself is required by socket.io-client.

So I decided to hack the browserify response object, like this:

import Response from 'meteor-node-stubs/node_modules/http-browserify/lib/response';
if(!Response.prototype.setEncoding) {
    Response.prototype.setEncoding = function(encoding){
        // do nothing
    }
}

And so far it works.

Activity

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

Metadata

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