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: getPayload node exits on webpack-hmr websocket failure #9279

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 9 additions & 6 deletions packages/payload/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ExecutionResult, GraphQLSchema, ValidationRule } from 'graphql'
import type { Request as graphQLRequest, OperationArgs } from 'graphql-http'
import type { Logger } from 'pino'
import type { NonNever } from 'ts-essentials'

import { spawn } from 'child_process'
import crypto from 'crypto'
Expand All @@ -25,12 +26,6 @@ import type {
SelectFromCollectionSlug,
TypeWithID,
} from './collections/config/types.js'

import { generateImportMap, type ImportMap } from './bin/generateImportMap/index.js'
export type { FieldState } from './admin/forms/Form.js'
export type * from './admin/types.js'
import type { NonNever } from 'ts-essentials'

import type { Options as CountOptions } from './collections/operations/local/count.js'
import type { Options as CreateOptions } from './collections/operations/local/create.js'
import type {
Expand Down Expand Up @@ -72,6 +67,7 @@ import type { TypeWithVersion } from './versions/types.js'
import { decrypt, encrypt } from './auth/crypto.js'
import { APIKeyAuthentication } from './auth/strategies/apiKey.js'
import { JWTAuthentication } from './auth/strategies/jwt.js'
import { generateImportMap, type ImportMap } from './bin/generateImportMap/index.js'
import { checkPayloadDependencies } from './checkPayloadDependencies.js'
import localOperations from './collections/operations/local/index.js'
import { consoleEmailAdapter } from './email/consoleEmailAdapter.js'
Expand All @@ -82,6 +78,9 @@ import { getLogger } from './utilities/logger.js'
import { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.js'
import { traverseFields } from './utilities/traverseFields.js'

export type { FieldState } from './admin/forms/Form.js'
export type * from './admin/types.js'

export interface GeneratedTypes {
authUntyped: {
[slug: string]: {
Expand Down Expand Up @@ -848,6 +847,10 @@ export const getPayload = async (
}
}
}

cached.ws.onerror = (_) => {
// swallow any websocket connection error
}
} catch (_) {
// swallow e
}
Expand Down
Loading