Skip to content

Commit

Permalink
fix(setupServer): print a dev utils error on failed remote connection
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Jan 8, 2025
1 parent c21f0bd commit 3826cad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/node/SetupServerApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { RemoteRequestHandler } from '~/core/handlers/RemoteRequestHandler'
import { shouldBypassRequest } from '~/core/utils/internal/requestUtils'
import { getRemoteContextFromEnvironment } from './remoteContext'
import { LifeCycleEventsMap } from '~/core/sharedOptions'
import { devUtils } from '~/core/utils/internal/devUtils'

const handlersStorage = new AsyncLocalStorage<RequestHandlersContext>()

Expand Down Expand Up @@ -143,9 +144,9 @@ export class SetupServerApi
)
},
() => {
// eslint-disable-next-line no-console
console.error(
`Failed to connect to a remote server at "${remoteContext.serverUrl}"`,
devUtils.error(
'Failed to enable remote mode: could not connect to the remote server at "%s"',
remoteContext.serverUrl,
)
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ it(
}),
)

await using testApp = await spawnTestApp(require.resolve('../use.app.js'))
await using testApp = await spawnTestApp(require.resolve('./use.app.js'))
const { listener, waitForRequestId } = spyOnLifeCycleEvents(remote)

const response = await fetch(new URL('/resource', testApp.url))
Expand Down Expand Up @@ -117,7 +117,7 @@ it(
it(
'emits correct events for the request handled in the remote process',
remote.boundary(async () => {
await using testApp = await spawnTestApp(require.resolve('../use.app.js'))
await using testApp = await spawnTestApp(require.resolve('./use.app.js'))
const { listener, waitForRequestId } = spyOnLifeCycleEvents(remote)

const response = await fetch(new URL('/resource', testApp.url))
Expand All @@ -143,7 +143,7 @@ it(
it(
'emits correct events for the request unhandled by either parties',
remote.boundary(async () => {
await using testApp = await spawnTestApp(require.resolve('../use.app.js'))
await using testApp = await spawnTestApp(require.resolve('./use.app.js'))
const { listener, waitForRequestId } = spyOnLifeCycleEvents(remote)

const resourceUrl = httpServer.http.url('/greeting')
Expand Down

0 comments on commit 3826cad

Please sign in to comment.