部署到服务器,获取用户openid请求api时超时,服务器上没有外网,怎么做?

小程序 文章 2022-03-08 15:20 0 全屏看文

部署到服务器,获取用户openid请求api时超时,服务器上没有外网,怎么做?When deploying to the server and getting the user's openid to request the api, it times out. There is no external network on the server. What should I do?

部署到服务器,获取用户openid请求api时超时,服务器上没有外网,怎么做?

部署到服务器,获取用户openid请求api时超时,服务器上没有外网,怎么做??

error: "ConnectionTimeoutError: Connect timeout for 5000ms, GET https://api.weixin.qq.com/sns/jscode2session?appid=xx&secret=xx&js_code=xx&grant_type=authorization_code -2 (connected: false, keepalive socket: false, agent status: {"createSocketCount":69,"createSocketErrorCount":0,"closeSocketCount":69,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":0,"freeSockets":{},"sockets":{},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 0) headers: {}" 部署到服务器,获取用户openid请求api时超时,服务器上没有外网,怎么做??

回答:

微喵网络:

连上外网

niceguy:除了连外网?
再见,电脑崽:

使用云函数托管

Mr.Zhao:

有外网就可以了

niceguy:有不用外网的方式吗,地址映射之类的?
Mr.Zhao:地址映射是个啥东西

-EOF-