Quasar SSR应用生产环境部署数小时后出现Hydration错误求助
生产环境Quasar SSR应用间歇性出现Hydration错误
我们基于Quasar框架SSR模式开发的codotto.com应用,存在一个难以调试的异常:仅在生产环境部署数小时(或根据网站流量不同可能缩短至几分钟)后出现Hydration错误,重新部署后恢复正常。
已完成的排查动作:
- 排除Cloudflare缓存问题:已在Cloudflare控制台完全禁用缓存,且通过CF-Cache-Status为DYNAMIC验证请求未走缓存。
- 本地及预发布(staging)环境均无法复现该问题,目前将排查范围缩小至服务器配置。
以下是生产和预发布环境的pm2配置:
生产环境pm2配置
// DO NOT MODIFY THIS FILE. THIS FILE IS RECREATED WITH EVERY DEPLOYMENT. module.exports = { name: "codotto.com", script: "index.js", args: "", log_type: "json", cwd: "xxxx/codotto.com/artifact", // Note: We detected that this web app is running on a server with multiple CPUs and hence we are // setting *instances* to "max" and *exec_mode* to "cluster_mode" for better performance. instances : 1, // change the value to "1" if your server has only 1 CPU // exec_mode : "cluster_mode", // remove this line if your server has only 1 CPU env: { "PORT": 7145, "CI": 1, "NUXT_TELEMETRY_DISABLED": 1 } }
预发布环境pm2配置
// DO NOT MODIFY THIS FILE. THIS FILE IS RECREATED WITH EVERY DEPLOYMENT. module.exports = { name: "staging.codotto.com", script: "index.js", args: "", log_type: "json", cwd: "xxxxx/staging.codotto.com/artifact", // Note: We detected that this web app is running on a server with multiple CPUs and hence we are // setting *instances* to "max" and *exec_mode* to "cluster_mode" for better performance. instances : 1, // change the value to "1" if your server has only 1 CPU // exec_mode : "cluster_mode", // remove this line if your server has only 1 CPU env: { "PORT": 9892, "CI": 1, "NUXT_TELEMETRY_DISABLED": 1 } }
我们已尝试Quasar官方的Hydration错误调试指南但未解决问题,应用通过Cleavr平台部署。若需复现bug,需先在codotto.com/auth/register注册账号,访问codotto.com会跳转至仪表盘。恳请各位提供调试思路或解释错误原因。
内容的提问来源于stack exchange,提问作者Bruno Francisco
相关产品推荐
相关产品推荐

