【发布时间】:2023-01-28 16:24:14
【问题描述】:
我正在使用一个 puppeteer 插件,当我需要手动解决验证码时,它会打开一个网络服务器。下面的代码在开发中有效,但我想不出一种方法让它在生产中工作。
我正在 render.com 上部署这个应用程序,据我所知,我只能听一个端口。
const app = express();
app.listen(process.env.PORT || "3000");
// I eventually get a link like this
// http://localhost:3001/?targetId=68C3007E851659A5D54CD6E023022C91
puppeteer.use(
PortalPlugin({
// This is a typical configuration when hosting behind a secured reverse proxy
webPortalConfig: {
listenOpts: {
port: 3001,
},
baseUrl: "http://localhost:3001",
},
})
);
我已经尝试在两台服务器上设置相同的端口,但正如预期的那样,我不断收到“端口已在使用”错误。我也试过将基本 url 指向我的 render.com URL,但是当我导航到插件提供的 url 时它会超时。
【问题讨论】:
标签: express tcp network-programming puppeteer