NovuN
Novu3y ago
Tobias

Novu Websocket fails (Websocket error)

I have novu setup (self hosted) with a nginx reverse proxy. While the Web Dashboard, the api, etc.. seem to work as they should, somehow the React Notifications center does not work because of this websocket error, which i cannot resolve:

WebSocket connection to 'wss://notifications.example.com/socket.io/?EIO=4&transport=websocket' failed:

(domain replaced with example.com)

Has anyone gotten this error already? Getting very frustrated from trying to debug this.


My Novu
.env
file:
# Root URL REACT_APP_WS_URL=https://notifications.example.com/ws # Uncomment this one when deploying Novu in the local environment # as Web app local Dockerfile will have to load this to be used. # Deployment version doesn't need as we inject it with API_ROOT_URL value. # REACT_APP_API_URL=http://localhost:3000 API_ROOT_URL=https://notifications.example.com/api DISABLE_USER_REGISTRATION=true FRONT_BASE_URL=http://notifications.example.com WIDGET_EMBED_PATH=https://notifications.example.com/embed.umd.min.js WIDGET_URL=https://notifications.example.com/widget # Context Paths # Only needed for setups with reverse-proxies GLOBAL_CONTEXT_PATH= WEB_CONTEXT_PATH= API_CONTEXT_PATH=api WS_CONTEXT_PATH=ws WIDGET_CONTEXT_PATH=widget

In my React component i configure the NovuProvider like this:

backendUrl=https://notifications.example.com/api
socketUrl=https://notifications.example.com/ws

As said, my dashboard, the login, the api itself, etc.. all works. I see the notification center and can opt-in and opt-out of channels, etc... it's just the service worker which does not connect.

Calling this url in the browser (https://notifications.example.com/ws/) directly gives me:

Hello World!

docker ps indicates that all docker containers are running on their correct ports, docker logs ws looks like the ws container started successfully. The healthcheck (https://notifications.example.com/ws/v1/health-check). Also gives a success on everything.
Was this page helpful?