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

private chat example code not working (part 1) #4532

Closed
acnologia000 opened this issue Nov 27, 2022 · 3 comments
Closed

private chat example code not working (part 1) #4532

acnologia000 opened this issue Nov 27, 2022 · 3 comments
Labels
question Further information is requested

Comments

@acnologia000
Copy link

Describe the bug
private chat example is not working ( i have tried switching back to nodejs 18.x from 19.x but it still shows the same problem)

To Reproduce
follow instruction to run the example code in document
Please fill the following code example:

Socket.IO server version: x.y.z

Server

import { Server } from "socket.io";

const io = new Server(3000, {});

io.on("connection", (socket) => {
  console.log(`connect ${socket.id}`);

  socket.on("disconnect", () => {
    console.log(`disconnect ${socket.id}`);
  });
});

Socket.IO client version: x.y.z

Client

import { io } from "socket.io-client";

const socket = io("ws://localhost:3000/", {});

socket.on("connect", () => {
  console.log(`connect ${socket.id}`);
});

socket.on("disconnect", () => {
  console.log("disconnect");
});

Expected behavior
npm run serve starts serving the example application

Platform:

  • Device: x64 laptop
  • OS: linux

Additional context
error trace :


 hridyansh  …/examples/private-messaging    v18.7.0 npm run serve

> private-messaging@0.1.0 serve
> vue-cli-service serve

 INFO  Starting development server...
10% building 2/5 modules 3 active ...ssaging/node_modules/eslint-loader/index.js??ref--14-0!/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/src/main.jsError: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at runSyncOrAsync (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at iterateNormalLoaders (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /home/hridyanshthakur/work/node/socket.io/examples/private-messaging/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.7.0

 hridyansh  …/examples/private-messaging    v18.7.0 A

@acnologia000 acnologia000 added the to triage Waiting to be triaged by a member of the team label Nov 27, 2022
@darrachequesne
Copy link
Member

Hi! I could indeed reproduce the issue with Node.js 18.

It seems to be a known issue:

As a temporary workaround, you can:

  • downgrade to Node.js 16
  • or allow deprecated ciphers with --openssl-legacy-provider Node.js option

It seems that it was fixed in @vue/cli v5: https://cli.vuejs.org/migrations/migrate-from-v4.html

@darrachequesne darrachequesne added question Further information is requested and removed to triage Waiting to be triaged by a member of the team labels Nov 30, 2022
@acnologia000
Copy link
Author

ohkay, i am using node 18, but at least it should be mentioned in example docs @darrachequesne

@xilef111
Copy link

xilef111 commented Apr 14, 2023

Is there a good/working solution for this now?

Im am trying to get the private messaging tutorial (https://socket.io/get-started/private-messaging-part-1/)working on node.js 18, but I does not work beacause of this issue.
Dont want to downgrade to node.js 16, because I don't want to start a new projekt with a version that is marked as depercated (https://endoflife.date/nodejs#:~:text=Ended%205%20months%20and%204%20weeks%20ago).

I tried to change vue-cli-service serve to vue-cli-service serve --openssl-legacy-provider in package.json file, but this does not solve the problem.

I also tried to use npm audit fix --force beacuse I think using the new versions of the packages would be the best.
Unfortunately, as a beginner to node.js/socket.io/vou I am not able to fix the problems resultion of the breaking changes from the autit fix.
Maybe someone more experienced is able to fix this, as from my point of view, this would be the best solution, because an official tutorial shold not contain 21 high risk vunerabilities.

@darrachequesne
If there is a solution or workaround to this, it should be descibed in detail in the tutorial, so that new users can complete the tutorial. Because, as a biginner, it is really frustrating if you follow an official tutorial and it is brocken by default right after cloning the reponsitory.

Kind Regards

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

3 participants