diff --git a/src/node/app.ts b/src/node/app.ts index 5fde2767..171a7c4d 100644 --- a/src/node/app.ts +++ b/src/node/app.ts @@ -45,7 +45,7 @@ export const createApp = async (args: DefaultedArgs): Promise<[Express, http.Ser } /** - * Get the address of a server as a string (protocol not included) while + * Get the address of a server as a string (protocol *is* included) while * ensuring there is one (will throw if there isn't). */ export const ensureAddress = (server: http.Server): string => { @@ -54,7 +54,7 @@ export const ensureAddress = (server: http.Server): string => { throw new Error("server has no address") } if (typeof addr !== "string") { - return `${addr.address}:${addr.port}` + return `http://${addr.address}:${addr.port}` } return addr } diff --git a/src/node/entry.ts b/src/node/entry.ts index 82e04f5d..3cca62a5 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -141,7 +141,7 @@ const main = async (args: DefaultedArgs): Promise => { if (args.link) { try { - await coderCloudBind(serverAddress, args.link.value) + await coderCloudBind(serverAddress.replace(/^https?:\/\//, ""), args.link.value) logger.info(" - Connected to cloud agent") } catch (err) { logger.error(err.message)