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

Cannot read property 'forEach' of undefined #67

Open
AliAtefAli opened this issue Apr 20, 2023 · 4 comments
Open

Cannot read property 'forEach' of undefined #67

AliAtefAli opened this issue Apr 20, 2023 · 4 comments
Labels
question Further information is requested

Comments

@AliAtefAli
Copy link

AliAtefAli commented Apr 20, 2023

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
Copy link

gutocf commented May 11, 2023

Same problem here.

@darrachequesne
Copy link
Member

darrachequesne commented May 15, 2023

@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)

@darrachequesne darrachequesne added the question Further information is requested label May 15, 2023
@alcalyn
Copy link

alcalyn commented Nov 16, 2023

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
Copy link

alcalyn commented Nov 16, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants