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

Compile with warnings #31

Closed
prince272 opened this issue Sep 6, 2023 · 6 comments
Closed

Compile with warnings #31

prince272 opened this issue Sep 6, 2023 · 6 comments

Comments

@prince272
Copy link

websockets/ws#1220

@hosseinmd
Copy link
Owner

Can you tell me what packages using WS?

@prince272
Copy link
Author

First of all, I'd like to say thanks for responding to me. Back to the problem:

I'm using your awesome react-signalr package with NextJS but there are some few errors I'd try my best to point out to you:

  • warn ./node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js
    [0] Module not found: Can't resolve 'bufferutil' in 'C:\Users\Prince\source\repos\NextSolution\src\NextSolution.WebApp\node_modules\engine.io-client\node_modules\ws\lib'
    [0]
    [0] Import trace for requested module:
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/websocket.js
    [0] ./node_modules/engine.io-client/node_modules/ws/index.js
    [0] ./node_modules/engine.io-client/build/cjs/transports/websocket-constructor.js
    [0] ./node_modules/engine.io-client/build/cjs/index.js
    [0] ./node_modules/socket.io-client/build/cjs/url.js
    [0] ./node_modules/socket.io-client/build/cjs/index.js
    [0] ./node_modules/react-signalr/lib/socket/utils.js
    [0] ./node_modules/react-signalr/lib/socket/provider/index.js
    [0] ./node_modules/react-signalr/lib/socket/context.js
    [0] ./node_modules/react-signalr/lib/socket/index.js
    [0] ./node_modules/react-signalr/lib/index.js
    [0] ./components/signalr.tsx
    [0] ./app/provider.tsx
    [0]
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/validation.js
    [0] Module not found: Can't resolve 'utf-8-validate' in 'C:\Users\Prince\source\repos\NextSolution\src\NextSolution.WebApp\node_modules\engine.io-client\node_modules\ws\lib'
    [0]
    [0] Import trace for requested module:
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/validation.js
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/receiver.js
    [0] ./node_modules/engine.io-client/node_modules/ws/index.js
    [0] ./node_modules/engine.io-client/build/cjs/transports/websocket-constructor.js
    [0] ./node_modules/engine.io-client/build/cjs/index.js
    [0] ./node_modules/socket.io-client/build/cjs/url.js
    [0] ./node_modules/socket.io-client/build/cjs/index.js
    [0] ./node_modules/react-signalr/lib/socket/utils.js
    [0] ./node_modules/react-signalr/lib/socket/provider/index.js
    [0] ./node_modules/react-signalr/lib/socket/context.js
    [0] ./node_modules/react-signalr/lib/socket/index.js
    [0] ./node_modules/react-signalr/lib/index.js
    [0] ./components/signalr.tsx
    [0] ./app/provider.tsx
    [0] - wait compiling...
    [0] - warn ./node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js
    [0] Module not found: Can't resolve 'bufferutil' in 'C:\Users\Prince\source\repos\NextSolution\src\NextSolution.WebApp\node_modules\engine.io-client\node_modules\ws\lib'
    [0]
    [0] Import trace for requested module:
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/websocket.js
    [0] ./node_modules/engine.io-client/node_modules/ws/index.js
    [0] ./node_modules/engine.io-client/build/cjs/transports/websocket-constructor.js
    [0] ./node_modules/engine.io-client/build/cjs/index.js
    [0] ./node_modules/socket.io-client/build/cjs/url.js
    [0] ./node_modules/socket.io-client/build/cjs/index.js
    [0] ./node_modules/react-signalr/lib/socket/utils.js
    [0] ./node_modules/react-signalr/lib/socket/provider/index.js
    [0] ./node_modules/react-signalr/lib/socket/context.js
    [0] ./node_modules/react-signalr/lib/socket/index.js
    [0] ./node_modules/react-signalr/lib/index.js
    [0] ./components/signalr.tsx
    [0] ./app/provider.tsx
    [0]
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/validation.js
    [0] Module not found: Can't resolve 'utf-8-validate' in 'C:\Users\Prince\source\repos\NextSolution\src\NextSolution.WebApp\node_modules\engine.io-client\node_modules\ws\lib'
    [0]
    [0] Import trace for requested module:
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/validation.js
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/receiver.js
    [0] ./node_modules/engine.io-client/node_modules/ws/index.js
    [0] ./node_modules/engine.io-client/build/cjs/transports/websocket-constructor.js
    [0] ./node_modules/engine.io-client/build/cjs/index.js
    [0] ./node_modules/socket.io-client/build/cjs/url.js
    [0] ./node_modules/socket.io-client/build/cjs/index.js
    [0] ./node_modules/react-signalr/lib/socket/utils.js
    [0] ./node_modules/react-signalr/lib/socket/provider/index.js
    [0] ./node_modules/react-signalr/lib/socket/context.js
    [0] ./node_modules/react-signalr/lib/socket/index.js
    [0] ./node_modules/react-signalr/lib/index.js
    [0] ./components/signalr.tsx
    [0] ./app/provider.tsx
    [0] Debugger attached.
    [0] Waiting for the debugger to disconnect...
    [0] [2023-09-08T21:08:24.963Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] [2023-09-08T21:08:24.965Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:24.965Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async checkForStart (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }
    [0] [2023-09-08T21:08:30.661Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] [2023-09-08T21:08:30.662Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:30.662Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async Timeout.checkForStart [as _onTimeout] (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }
    [0] [2023-09-08T21:08:36.662Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] [2023-09-08T21:08:36.662Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:36.663Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async Timeout.checkForStart [as _onTimeout] (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }
    [0] [2023-09-08T21:08:42.670Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] [2023-09-08T21:08:42.671Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:42.671Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async Timeout.checkForStart [as _onTimeout] (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }
    [0] [2023-09-08T21:08:48.680Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] [2023-09-08T21:08:48.680Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:48.681Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async Timeout.checkForStart [as _onTimeout] (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }
    [0] - wait compiling...
    [0] - warn ./node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js
    [0] Module not found: Can't resolve 'bufferutil' in 'C:\Users\Prince\source\repos\NextSolution\src\NextSolution.WebApp\node_modules\engine.io-client\node_modules\ws\lib'
    [0]
    [0] Import trace for requested module:
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/websocket.js
    [0] ./node_modules/engine.io-client/node_modules/ws/index.js
    [0] ./node_modules/engine.io-client/build/cjs/transports/websocket-constructor.js
    [0] ./node_modules/engine.io-client/build/cjs/index.js
    [0] ./node_modules/socket.io-client/build/cjs/url.js
    [0] ./node_modules/socket.io-client/build/cjs/index.js
    [0] ./node_modules/react-signalr/lib/socket/utils.js
    [0] ./node_modules/react-signalr/lib/socket/provider/index.js
    [0] ./node_modules/react-signalr/lib/socket/context.js
    [0] ./node_modules/react-signalr/lib/socket/index.js
    [0] ./node_modules/react-signalr/lib/index.js
    [0] ./components/signalr.tsx
    [0] ./app/provider.tsx
    [0]
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/validation.js
    [0] Module not found: Can't resolve 'utf-8-validate' in 'C:\Users\Prince\source\repos\NextSolution\src\NextSolution.WebApp\node_modules\engine.io-client\node_modules\ws\lib'
    [0]
    [0] Import trace for requested module:
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/validation.js
    [0] ./node_modules/engine.io-client/node_modules/ws/lib/receiver.js
    [0] ./node_modules/engine.io-client/node_modules/ws/index.js
    [0] ./node_modules/engine.io-client/build/cjs/transports/websocket-constructor.js
    [0] ./node_modules/engine.io-client/build/cjs/index.js
    [0] ./node_modules/socket.io-client/build/cjs/url.js
    [0] ./node_modules/socket.io-client/build/cjs/index.js
    [0] ./node_modules/react-signalr/lib/socket/utils.js
    [0] ./node_modules/react-signalr/lib/socket/provider/index.js
    [0] ./node_modules/react-signalr/lib/socket/context.js
    [0] ./node_modules/react-signalr/lib/socket/index.js
    [0] ./node_modules/react-signalr/lib/index.js
    [0] ./components/signalr.tsx
    [0] ./app/provider.tsx
    [0] [2023-09-08T21:08:57.866Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async Timeout.checkForStart [as _onTimeout] (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }
    [0] [2023-09-08T21:08:57.867Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:57.867Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:58.157Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] [2023-09-08T21:08:58.157Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:58.158Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async checkForStart (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }
    [0] [2023-09-08T21:08:58.398Z] Warning: Error from HTTP request. TypeError: fetch failed.
    [0] [2023-09-08T21:08:58.399Z] Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] [2023-09-08T21:08:58.399Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] FailedToNegotiateWithServerError: Failed to complete negotiation with the server: TypeError: fetch failed
    [0] at HttpConnection._getNegotiationResponse (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:256:35)
    [0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    [0] at async HttpConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:172:41)
    [0] at async HttpConnection.start (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HttpConnection.js:75:9)
    [0] at async HubConnection._startInternal (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:132:9)
    [0] at async HubConnection._startWithStateTransitions (webpack-internal:///(ssr)/./node_modules/@microsoft/signalr/dist/cjs/HubConnection.js:109:13)
    [0] at async checkForStart (webpack-internal:///(ssr)/./node_modules/react-signalr/lib/signalr/provider/providerNativeFactory.js:32:25) {
    [0] errorType: 'FailedToNegotiateWithServerError'
    [0] }

@prince272
Copy link
Author

But everything works fine. I'm only using SignalR with these configurations:

    withCredentials={api.config.withCredentials}
    automaticReconnect={true}
    connectEnabled={true}
    accessTokenFactory={currentUser ? () => currentUser.accessToken : undefined}
    dependencies={[currentUser]} // remove previous connection and create a new connection if changed
    logMessageContent={false}
    url={new URL("/signalr", api.config.baseURL).toString()}

@prince272
Copy link
Author

Can you tell me what packages using WS?

I don't use the WS anywhere, I just use the SignalR feature.

@hosseinmd
Copy link
Owner

This is because we supported socketio too, you can import just signalR by "react-signalr/signalr"

install latest version and import like this

import { createSignalRContext } from "react-signalr/signalr";

@prince272
Copy link
Author

Thank you so much. This library is amazing.

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

No branches or pull requests

2 participants