Fork me on GitHub
#shadow-cljs
<
2020-06-14
>
valerauko01:06:13

i'm running shadow-cljs in electron and i can't figure out what would be a good contentsecuritypolicy header. anyone has a working example maybe? i don't use any non-local resources

rberger02:06:41

I am running my target browser app on Safari on iOS. shadow-cljs works fine with that in regular http defaults. But I have to run the page with SSL/HTTPS. because I’m testing out webRTC stuff which requires the page be served with SSL. I successfully get shadow-cljs to serve the page with ssl/https but the websocket errors out. I’ve tried: • Just adding :ssl {} • Adding:

:ssl {} 
 :http {:port 9630 :host "discovery.local"}
• Adding:
:ssl {} 
 :http {:port 9630  :ssl-port 19630 :host "discovery.local"}
In all cases the basic page works but the websocket doesn’t Here is the error from the debugger:
🠶 shadow-cljs: websocket error
Event
bubbles: false
cancelBubble: false
cancelable: false
composed: false
currentTarget: null
defaultPrevented: false
eventPhase: 0
isTrusted: true
returnValue: true
srcElement: WebSocket
URL: ""
binaryType: "blob"
bufferedAmount: 0
extensions: ""
onclose: null
onerror: null
onmessage: null
onopen: null
protocol: ""
readyState: 3
url: ""
WebSocket Prototype
target: WebSocket
URL: ""
binaryType: "blob"
bufferedAmount: 0
extensions: ""
onclose: null
onerror: null
onmessage: null
onopen: null
protocol: ""
readyState: 3
url: ""
WebSocket Prototype
timeStamp: 1101
type: "error"
Event Prototype

[Error] WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.)
🠶 shadow-cljs: WebSocket disconnected!

thheller08:06:18

@rberger best option is to enable ssl for shadow-cljs. otherwise you'll have mixed content. https://shadow-cljs.github.io/docs/UsersGuide.html#_ssl

rberger03:06:32

I did enable ssl as per the docs and it looks like everthing is using ssl, bu the websocket (<wss://discovery.local:9630/ws/worker/app/5010a5c1-8b82-4796-b5ba-1ed7b3358476/4ccf7ba7-f35c-4021-80a5-0f9b2cb292e7/browser>) is still failing. I suspect its something to do with how Apple/Safari does the remote debugger

thheller08:06:01

@vale I'd suggest not using CSP in dev at all so you don't have to worry about it regarding shadow-cljs and then use a proper one for release?

rberger22:06:12

Looks like shadow-cljs 2.10.8 is on clojars but http://npmjs.com has only 2.10.7

mauricio.szabo22:06:04

Hi, I updated shadow-cljs yesterday, and I'm getting the message The shadow-cljs Websocket was disconnected more frequently. About two~three weeks ago (last time I upgraded) I could leave the watch process and my node process running while putting my computer to sleep and then keep working on my CLJS, but currently it seems that this is not working anymore...

👍 3
beders22:06:17

Just stopped by to say that I love the latest Inspector changes. So easy to sprinkle in a few tap> s to see what is going on. Well done!