Webhook隧道未连接

时间:2019-02-18 12:53:54

标签: javascript node.js express webhooks contentful

我已经创建了NextJS和Express应用程序。有一些简单的测试路由是这样的:

const server = express();

server.get('/api/test', (req, res) => {
  res.status(200).send({ message: 'test' });
});

server.listen(3000);

当我在浏览器中访问http://localhost:3000/api/test或作为Postman中的GET请求时,我成功地在JSON对象中获取了测试消息。

我现在已经从ContentCMS设置了Webhook。为了在本地进行测试,我使用了Ngrok,它路由到上面的URL。当我测试Webhook时,Ngrok接受请求,但返回此错误:

The connection to http://xxxxx.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:3000/api/test.

Make sure that a web service is running on localhost:3000/api/test and that it is a valid address.

The error encountered was: dial tcp: lookup tcp/3000/api/test: nodename nor servname provided, or not known

我不知道这是怎么回事。我的手动测试证明了端点确实有效。为什么Ngrok无法连接到它?作为辅助测试,我尝试使用Ultrahook代替Ngrok,但是存在相同的问题。

编辑: Ngrok的主要错误是:502 Bad Gateway

0 个答案:

没有答案