dosubot[bot] commented on issue #35340:
URL: https://github.com/apache/superset/issues/35340#issuecomment-3352328836

   <!-- Answer -->
   WebSockets let Superset push async query results to your browser in real 
time, so you don’t have to poll or refresh to see updates. This is especially 
useful for dashboards and long-running queries.
   
   Your setup has a few common pitfalls:
   
   1. **WebSocket URL**: The `GLOBAL_ASYNC_QUERIES_WEBSOCKET_URL` must be 
reachable from the browser, not just from inside the container. If you use 
`ws://127.0.0.1:8080/`, browsers outside Docker can’t connect. Set it to your 
public hostname and proxied path, e.g. `wss://my.domain.fr/ws` if you’re using 
HTTPS and Nginx is proxying `/ws` to the websocket service. 
[source](https://github.com/apache/superset/discussions/33293)
   
   2. **JWT Secret**: The JWT secret for async queries must be at least 32 
bytes and must match exactly in both Superset and the websocket server config. 
If it’s too short or mismatched, you’ll get connection/auth errors. 
[source](https://github.com/apache/superset/discussions/34703)
   
   3. **Nginx Proxy**: Your Nginx config for `/ws` looks correct for basic 
setups, but make sure it’s actually forwarding requests to the right container 
and port, and that no other service is using port 8080. Superset and 
superset-websocket must use different ports. 
[source](https://github.com/apache/superset/discussions/34609)
   
   4. **CSP Errors**: The Content Security Policy (CSP) blocks inline scripts 
and WebSocket connections by default. You need to add your websocket URL to the 
`connect-src` directive in `TALISMAN_CONFIG` in your `superset_config.py`:
      ```python
      TALISMAN_CONFIG = {
          "content_security_policy": {
              "connect-src": [
                  "'self'",
                  "wss://my.domain.fr/ws",  # Add your websocket endpoint here
              ],
              # ... other directives ...
          },
          # ... other config ...
      }
      ```
      [source](https://github.com/apache/superset/discussions/34703)
   
   5. **Frontend/Runtime Errors**: Errors like `messages is undefined` or JSON 
parse errors often mean the frontend is getting a bad or empty response from 
the backend or websocket. These usually clear up once the WebSocket and CSP 
issues are fixed, but can also be caused by incomplete frontend builds. If you 
see missing assets or broken UI, make sure the frontend assets are built and 
available. [source](https://github.com/apache/superset/issues/32187)
   
   6. **Production Note**: The default Docker Compose setup is for development 
only. For production, use strong secrets, review all configs, and consider a 
more secure orchestration setup. 
[source](https://github.com/apache/superset/issues/34773)
   
   In summary: update your WebSocket URL to a public address, ensure your JWT 
secret is long and matches everywhere, add your WebSocket endpoint to CSP, and 
check that Nginx is proxying correctly. If you still see errors, check browser 
network logs for failed requests and the websocket server logs for JWT or 
connection errors.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/24e54802-8849-4af6-bd28-d33089061e1c?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/24e54802-8849-4af6-bd28-d33089061e1c?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/24e54802-8849-4af6-bd28-d33089061e1c?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/24e54802-8849-4af6-bd28-d33089061e1c?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/24e54802-8849-4af6-bd28-d33089061e1c?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/24e54802-8849-4af6-bd28-d33089061e1c?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/24e54802-8849-4af6-bd28-d33089061e1c?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
 b)&nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/35340)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to