Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹 fix(patch): revert server port check #2431

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions sources/@roots/bud-server/src/server/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import type {Server as HttpsServer} from 'node:https'

import {bind} from '@roots/bud-support/decorators/bind'
import {BudError, ServerError} from '@roots/bud-support/errors'
import {
portOrPortsToNumbers,
requestPorts,
} from '@roots/bud-support/get-port'
import logger from '@roots/bud-support/logger'

/**
Expand Down Expand Up @@ -47,30 +43,11 @@ export abstract class BaseServer implements Connection {
throw new Error(`No server instance found.`)
}

const port = Number(
await requestPorts(portOrPortsToNumbers(this.app.server?.url.port)),
)

if (`${port}` !== `${this.app.server.url.port}`) {
const axios = await import(`@roots/bud-support/axios`).then(
pkg => pkg.default,
)
const request = await axios.get(this.app.server.url.port)
this.app.server.logger.warn(
`Could not bind to port ${this.app.server.url.port}. It may already be in use.`,
`\n`,
`Request to ${this.app.server.url.port} returned ${request.status}.`,
`\n`,
request.headers,
)
this.app.server.logger.warn(`Using port ${port} instead.`)
}

this.instance
.listen(
this.app.hooks.filter(`dev.listenOptions`, {
host: this.app.server?.url.hostname,
port,
port: parseInt(this.app.server?.url.port),
}),
)
.on(
Expand Down
Loading