Plugging Companion into an already existing server

Hello everyone!
I’m kind of new with uppy but I’m having lots of troubles with plugging Companion into my node js server. In the explanations you use localhost and it works fine but when I try to replace it with my domain name I get “WebSocket connection to ‘wss://domainName.com/api/8ae313e6-7bdf-44d3-afa5-0d36a1d52f5b’ failed: Error during WebSocket handshake: Unexpected response code: 520”.
In my node server I have: server: {
host: ‘domain.com’,
protocol: ‘https’
},

and in my client:
const uppy = Uppy.Core({debug: true, autoProceed: true})
// uppy.use(Uppy.FileInput, { target: ‘.UppyForm’, replaceTargetContent: true })
.use(Uppy.XHRUpload, {
endpoint: ‘https://domain.com/uploads/files’,
formData: true,
fieldName: ‘files’,
method: ‘post’,
id: ‘XHRUpload’,
}
headers: {
contentType: ‘image/png’
}
})
.use(Uppy.ProgressBar, {
target: ‘body’,
fixed: true,
hideAfterFinish: false
})
.use(Uppy.Dashboard, { trigger: ‘#uppyModalOpener’,
replaceTargetContent: true,
showProgressDetails: true,
width: 2000,
height: 700,
browserBackButtonClose: true,
inline: true,
showLinkToFileUploadResult: true,
hideUploadButton: false,
hideRetryButton: false,
hidePauseResumeButton: false,
hideCancelButton: false,
hideProgressAfterFinish: false,
closeAfterFinish: false,
disableStatusBar: false,
disableInformer: false,
disableThumbnailGenerator: false,
disablePageScrollWhenModalOpen: true,
animateOpenClose: true,
proudlyDisplayPoweredByUppy: false,

		})
		.use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: 'https://*domain*.com',endpoint: 'https://*domain*.com/uploads/files'})
		.use(Uppy.Dropbox, { target: Uppy.Dashboard, companionUrl: 'https://*domain*.com',endpoint: 'https://*domain*.com/uploads/files'})
		.use(Uppy.GoogleDrive, { target: Uppy.Dashboard,  companionUrl: 'https://*domain*.com',endpoint: 'https://*domain*.com/uploads/files' });

please help me, Thank you!

Do you see any error(s) logged on your server when this issue happens?

No, and this error is shown in the dev tools console.

ok, not sure how your http server (e.g nginx) is setup, but I think you need allow wss in your server configuration somehow. Also I’d double check if there are not errors logged on the server side (both on the express.js server and http server)

Just to make sure that you have all the details.
Im using companion inside my express server on port 3020.
I have stopped the nginx server hoping it won’t affect any traffic to and from my server (on aws ec2 instance).

I am also getting the same error Alon. Please let me know the solution for this.

Copying the solution you mentioned in the Github issue here in case people come searching in this thread:

Issue solved. Needed to add this code on companion node server app.js file

var server = httpsServer.listen(443)
uppy.socket(server, options)