You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行node server.js时提示'encrypted'已废弃,需改用'useTLS',求解决

Fix for "'encrypted' option is deprecated in favor of 'useTLS'" Error in Pusher Configuration

The error you're encountering has nothing to do with your Chrome browser's TLS settings—it's a server-side configuration issue with the Pusher Node.js SDK you're using. The encrypted option was officially deprecated in newer versions of the library, and it's been replaced with the useTLS option.

Step-by-Step Fix:

  1. Find the Pusher initialization section in your server.js file:
    const pusher = new Pusher({
      appId: process.env.PUSHER_APP_ID,
      key: process.env.PUSHER_KEY,
      secret: process.env.PUSHER_SECRET,
      cluster: process.env.PUSHER_CLUSTER,
      encrypted: true, // This line is deprecated
    });
    
  2. Replace the deprecated encrypted: true line with useTLS: true:
    const pusher = new Pusher({
      appId: process.env.PUSHER_APP_ID,
      key: process.env.PUSHER_KEY,
      secret: process.env.PUSHER_SECRET,
      cluster: process.env.PUSHER_CLUSTER,
      useTLS: true, // Updated to the recommended option
    });
    

Quick Extra Check:

Ensure you're running a recent version of the pusher npm package. If you're on an outdated version, this change might not work properly. Update it with:

npm install pusher@latest

Test the Solution:

Save your modified server.js file, then restart your server using:

node server.js

The deprecation error should disappear, and your Pusher integration will still use TLS encryption as intended.

内容的提问来源于stack exchange,提问作者Meriem Bader

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:50:31