DIYgod / RSSHub

🧡 Everything is RSSible
https://docs.rsshub.app
MIT License
34.06k stars 7.59k forks source link

配置代理后无法启动 #14945

Closed krau closed 8 months ago

krau commented 8 months ago

路由地址

NOROUTE

完整路由地址

NOROUTE

相关文档

https://docs.rsshub.app/deploy/config#proxy-configurations

预期是什么?

rsshub 正确使用代理进行抓取

实际发生了什么?

配置代理后报错, rsshub 无法启动

部署

自建

部署相关信息

No response

额外信息

更新了镜像之后突然炸了, 没有动什么配置, 所以看起来是最近提交中的问题.
使用的是 socks5h 代理, 错误日志:

rsshub-1       | warn: PROXY_URI is an HTTPS/SOCKS proxy with authentication, which is not supported by puppeteer (ignore if you don't need it)rsshub-1       | info: To get rid of this, consider using an HTTP proxy instead
rsshub-1       | file:///app/lib/utils/proxy/index.ts:1
rsshub-1       | import{config}from"@/config";const proxyIsPAC=config.pacUri||config.pacScript;import pacProxy from"./pac-proxy";import unifyProxy from"./unify-proxy";let proxyUri;let proxyObj;let proxyUrlHandler=null;if(proxyIsPAC){const proxy=pacProxy(config.pacUri,config.pacScript,config.proxy);proxyUri=proxy.proxyUri;proxyObj=proxy.proxyObj;proxyUrlHandler=proxy.proxyUrlHandler}else{const proxy=unifyProxy(config.proxyUri,config.proxy);proxyUri=proxy.proxyUri;proxyObj=proxy.proxyObj;proxyUrlHandler=proxy.proxyUrlHandler}let agent=null;if(proxyIsPAC){const{PacProxyAgent}=require("pac-proxy-agent");agent=new PacProxyAgent(`pac+${proxyUri}`)}else if(proxyUri){if(proxyUri.startsWith("http")){const{HttpsProxyAgent}=require("https-proxy-agent");agent=new HttpsProxyAgent(proxyUri)}else if(proxyUri.startsWith("socks")){const{SocksProxyAgent}=require("socks-proxy-agent");agent=new SocksProxyAgent(proxyUri)}}var proxy_default={agent,proxyUri,proxyObj,proxyUrlHandler};export{proxy_default as default};
rsshub-1       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
rsshub-1       | 
rsshub-1       | ReferenceError: require is not defined in ES module scope, you can use import instead
rsshub-1       |     at file:///app/lib/utils/proxy/index.ts:1:833
rsshub-1       |     at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
rsshub-1       |     at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
rsshub-1       |     at async loadESM (node:internal/process/esm_loader:28:7)
rsshub-1       |     at async handleMainPromise (node:internal/modules/run_main:120:12)
rsshub-1       | 
rsshub-1       | Node.js v21.7.1
rsshub-1 exited with code 0

这不是重复的 issue

ytoaa commented 8 months ago

It's the same for me at the moment.

DIYgod commented 8 months ago

Fixed in f837345f36c5c34a6bb8540e7a4259ab7d110e81