socketio / socket.io-admin-ui

Admin UI for Socket.IO
https://admin.socket.io
MIT License
358 stars 95 forks source link

Cannot read property 'forEach' of undefined #67

Open AliAtefAli opened 1 year ago

AliAtefAli commented 1 year ago

I want to connect the client web page for socketIO and admin-UI. But this error appeared.

image

When I use the code below.

const { createServer } = require("http");
const Server  = require("socket.io");
const { instrument } = require("@socket.io/admin-ui");

const httpServer = createServer();

const io = new Server(httpServer, {
  cors: {
    origin: ["https://admin.socket.io"],
    credentials: true
  }
});

instrument(io, {
  auth: false
});

httpServer.listen(3000);
gutocf commented 1 year ago

Same problem here.

darrachequesne commented 1 year ago

@gutocf which version of the socket.io package are you using? v2?

The module is compatible with:

  • Socket.IO v4 server
  • Socket.IO v3 server (>= 3.1.0), but without the operations on rooms (join, leave, disconnection)
alcalyn commented 1 year ago

Also having such errors. First I login (had to remove the trailing slash in server url to make it work).

Then I have empty inerface and tabs. I have to select the "/" namespace

image

to see something, but only in Events tab. Other tabs are empty and I see javascript errors:

image

also I have lot of unhealhty servers growing up

image

Tried on firefox and chromium. When I enter wrong server url (the one with trailing slash), firefox display xhr error and I have to change server url. Chromium also displays an error, but popin disappear and I can enter to a blank admin ui.

I use socket.io 4.5.4

    "socket.io": "^4.5.4",
    "socket.io-client": "^4.5.4",

And instrumented the server with

const app = express();
const server = http.createServer(app);
const io = new Server(server, {
    cors: {
        origin: ['https://admin.socket.io'],
        credentials: true,
    },
});

instrument(io, {
    auth: false,
    mode: 'development',
});
alcalyn commented 1 year ago

Ok my bad, I had a custom parser, which was not expected by admin ui...