运行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:
- Find the Pusher initialization section in your
server.jsfile: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 }); - Replace the deprecated
encrypted: trueline withuseTLS: 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
相关产品推荐
相关产品推荐

