When the server is deployed to Google Cloud Run (or any server that enforces Content-Length), the curl request in buildCurlCommand fails resulting in an inability to pair a new device. This could be due to sending the POST without a "-d" parameter, resulting in the Content-Length header being generated with 0 length.
This was verified by logging the server-side headers when processing handlePairDevice :
[backend] {
[backend] host: 'xxxx.app',
[backend] 'user-agent': 'curl/7.73.0',
[backend] 'content-length': '0',
[backend] accept: '/',
[backend] 'x-forwarded-for': 'xx.xx.xx.xx',
[backend] 'x-forwarded-host': 'xxxx.app',
[backend] 'x-forwarded-proto': 'https',
[backend] 'accept-encoding': 'gzip'
[backend] }