As the error message says, you cannot use the Access-Control-Allow-Origin character with Access-Control-Allow-Credentials . By default, the cors module uses wild origin, and by default socket.io requires credentials (or so, it seems, here, anyway). What you need to do is read the Origin request header and include it in the Access-Control-Allow-Origin response.
Fortunately, cors makes this very simple: to reflect the start of the request, go to the options object with the property origin: true . You also need the credentials: true property to allow credentials in general:
app.use(cors({ origin: true, credentials: true }));
source share