VinerzZ
CDCloudflare Developers
•Created by VinerzZ on 6/12/2024 in #workers-help
Workers TCP connect().startTls() instantly closing
Hello everyone! I am currently in a battle to make a successful mysql connection through workers. It seems I am pretty close, since I can successfully authenticate the client when there is no tls involved. Of course, this is not something you would expect to do in a production environment, so I am having two roadblocks:
1. If I use the TCP connection from the worker and then escalate it with startTls(), both connections (secure and insecure) immediately close. If I don’t escalate to TLS, the insecure socket remains active indefinitely.
2. I could, instead, escalate to TLS using the mysql driver itself and use the insecure TCP. For that, I’ve trying to finalise a compatibility layer of node modules, which is going pretty well without resorting to weird hacks. The only native package I can’t import in any form is node:tls. It fails with node: prefix, I tried looking into globalThis, importing from tls only (which also failed) and I am out of options here. Anyone had similar issues?
Extra: If I try to use secureTransport: “on”, the socket errors immediately with “Cannot connect to this address”
I am using AWS RDS.
compatibility_flags = [“nodejs_compat”]
I am not using the more profound node_compat = true, since I got 99% of the process working.
1 replies