{"record":{"id":"8cdc12d21d5c315b","repo":"medusajs/medusa","slug":"hmr-bind-host-is-set-but-a-custom-hmr-server-is-al","errorCode":null,"errorMessage":"HMR_BIND_HOST is set but a custom hmr.server is already configured. HMR_BIND_HOST will be ignored.","messagePattern":"HMR_BIND_HOST is set but a custom hmr\\.server is already configured\\. HMR_BIND_HOST will be ignored\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/admin/admin-bundler/src/utils/config.ts","lineNumber":119,"sourceCode":"      pluginEnv[key.replace(/^PLUGIN_/, \"\")] = value\n    }\n  }\n  baseConfig.define![\"process.env\"] = JSON.stringify(pluginEnv)\n\n  let finalConfig = baseConfig\n  if (options.vite) {\n    const customConfig = options.vite(baseConfig)\n    finalConfig = mergeConfig(baseConfig, customConfig)\n  }\n\n  // Handle HMR_BIND_HOST after merge to detect conflicts\n  if (process.env.HMR_BIND_HOST) {\n    if (\n      finalConfig.server?.hmr &&\n      typeof finalConfig.server.hmr === \"object\" &&\n      finalConfig.server.hmr.server\n    ) {\n      console.warn(\n        \"HMR_BIND_HOST is set but a custom hmr.server is already configured. HMR_BIND_HOST will be ignored.\"\n      )\n    } else {\n      const { createServer } = require(\"http\")\n      const hmrServer = createServer()\n      hmrServer.listen(hmrPort, process.env.HMR_BIND_HOST)\n      if (!finalConfig.server) {\n        finalConfig.server = {}\n      }\n      if (\n        !finalConfig.server.hmr ||\n        typeof finalConfig.server.hmr !== \"object\"\n      ) {\n        finalConfig.server.hmr = {}\n      }\n      finalConfig.server.hmr.server = hmrServer\n    }\n  }","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-bundler/src/utils/config.ts#L101-L137","documentation":"The admin bundler supports HMR_BIND_HOST to bind the HMR websocket server to a specific host (e.g. for Docker or remote dev). If your Vite config already defines server.hmr.server (a custom WebSocket server), the env var cannot be applied, so it logs this warning and continues — the custom hmr.server takes precedence and HMR_BIND_HOST is silently ignored.","triggerScenarios":"Starting the admin dev/bundling process with HMR_BIND_HOST set while the effective Vite config contains an object server.hmr with a non-empty server property (from user config or merged defaults).","commonSituations":"Docker/containerized development where HMR_BIND_HOST=0.0.0.0 is recommended, but a template or prior customization also set hmr.server; upgrading admin-bundler where default config now includes an hmr object.","solutions":["Remove the custom server.hmr.server from your Vite config and rely on HMR_BIND_HOST alone","Or drop HMR_BIND_HOST and configure the host directly on your custom hmr.server","Verify after restart that HMR connects from your environment (container/remote host) via the browser console","The warning is harmless if your existing hmr.server already binds the desired host — no action needed"],"exampleFix":"// before (vite.config / admin config)\nserver: { hmr: { server: myHttpServer } }\n# plus HMR_BIND_HOST=0.0.0.0 → warning, env ignored\n\n// after — pick one mechanism\nserver: { hmr: { server: myHttpServer, host: \"0.0.0.0\" } }\n# or remove hmr.server entirely and keep HMR_BIND_HOST=0.0.0.0","handlingStrategy":"validation","validationCode":"if (process.env.HMR_BIND_HOST && customViteConfig?.server?.hmr?.server) {\n  console.log(\"HMR_BIND_HOST will be ignored — configure hmr.server.host instead\")\n}","typeGuard":"const hasCustomHmrServer = (c) =>\n  Boolean(c?.server?.hmr && typeof c.server.hmr === \"object\" && c.server.hmr.server)","tryCatchPattern":"null","preventionTips":["Use exactly one mechanism to configure HMR binding","In Docker dev setups prefer HMR_BIND_HOST=0.0.0.0 with no custom hmr.server","Treat this warning as a signal that two config sources are fighting"],"tags":["vite","hmr","dev-server","configuration-warning"],"backgroundTag":"dev-server-config-conflict","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}