WIP: Add wvpc tcp service and hyperdrive -> wvpc support#12561
WIP: Add wvpc tcp service and hyperdrive -> wvpc support#12561xortive wants to merge 1 commit intocloudflare:mainfrom
Conversation
|
| // Display service-specific details | ||
| if (service.type === ServiceType.Http) { | ||
| if (service.type === ServiceType.Tcp) { | ||
| logger.log(` TCP Port: ${service.tcp_port}`); |
There was a problem hiding this comment.
🟡 Missing undefined guard for tcp_port causes "TCP Port: undefined" output
When creating a TCP VPC service, service.tcp_port is logged unconditionally, but tcp_port is an optional field (tcp_port?: number in the ConnectivityService interface at packages/wrangler/src/vpc/index.ts:65). If the API returns a TCP service without a tcp_port value, the output will display TCP Port: undefined to the user.
Inconsistency with HTTP port handling
The HTTP port handling on lines 57-63 correctly guards against undefined values:
if (service.http_port) {
logger.log(` HTTP Port: ${service.http_port}`);
}
if (service.https_port) {
logger.log(` HTTPS Port: ${service.https_port}`);
}But the TCP branch at line 56 logs unconditionally:
logger.log(` TCP Port: ${service.tcp_port}`);Since tcp_port is optional and the --tcp-port CLI option is not required (demandOption is not set, see packages/wrangler/src/vpc/index.ts:102-107), the API could return a response without tcp_port, resulting in the string "TCP Port: undefined" being printed to the user.
| logger.log(` TCP Port: ${service.tcp_port}`); | |
| if (service.tcp_port) { | |
| logger.log(` TCP Port: ${service.tcp_port}`); | |
| } | |
Was this helpful? React with 👍 or 👎 to provide feedback.
| // Display service-specific details | ||
| if (service.type === ServiceType.Http) { | ||
| if (service.type === ServiceType.Tcp) { | ||
| logger.log(` TCP Port: ${service.tcp_port}`); |
There was a problem hiding this comment.
🟡 Missing undefined guard for tcp_port causes "TCP Port: undefined" output in update handler
Same issue as in create.ts: the update.ts handler logs service.tcp_port unconditionally at line 61, but tcp_port is optional. This will display TCP Port: undefined if the field is not set.
Inconsistency with HTTP port handling
The HTTP port handling on lines 62-68 correctly guards against undefined values with if (service.http_port) and if (service.https_port), but the TCP branch at line 61 does not:
logger.log(` TCP Port: ${service.tcp_port}`);This inconsistency means TCP services could show malformed output to the user.
| logger.log(` TCP Port: ${service.tcp_port}`); | |
| if (service.tcp_port) { | |
| logger.log(` TCP Port: ${service.tcp_port}`); | |
| } | |
Was this helpful? React with 👍 or 👎 to provide feedback.
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
Uh oh!
There was an error while loading. Please reload this page.