【问题标题】:WhatsApp Business API error 1006 on every api call每次 api 调用的 WhatsApp Business API 错误 1006
【发布时间】:2022-01-22 02:29:47
【问题描述】:

我已经在生产 Kubernetes 环境中部署了 WhatsApp Business API 客户端的多连接设置,使用 Minikube Developer Setup: Multiconnect on Minikube 的文档作为参考。

但是在第一次登录时,为了获取身份验证令牌,我在 Postman 上收到以下错误:

{
    "meta": {
        "version": "v2.37.1",
        "api_status": "stable"
    },
    "errors": [
        {
            "code": 1006,
            "title": "Resource not found",
            "details": "URL path not found"
        }
    ]
}

所有容器都在运行:

NAME                                           READY   STATUS      RESTARTS   AGE
mysql-dev-6cdc47979f-6f6t5                     1/1     Running     0          2d23h
whatsapp-coreapp-deployment-7bb4c6b8bc-qw946   1/1     Running     0          24m
whatsapp-coreapp-deployment-7bb4c6b8bc-zkj5z   1/1     Running     0          24m
whatsapp-master-deployment-84ffbdd48d-4rw8w    1/1     Running     0          24m
whatsapp-master-deployment-84ffbdd48d-zwvlq    1/1     Running     0          24m
whatsapp-web-deployment-74b99f4579-s44lp       1/1     Running     1          25m
whatsapp-web-deployment-74b99f4579-sn55t       1/1     Running     0          25m

并且给定的错误发生在 Postman 的每次调用中,不仅在登录时(检查健康、获取用户、登录、登录管理员等),所有这些都给出相同的错误:

"code": 1006,
"title": "Resource not found",
"details": "URL path not found"

我检查了容器日志,我为每个调用的路径返回 404:

[2021-12-20 12:40:57.546610] app.INFO: [dd610cd0d21e431fafafc737c323565e] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-20 12:40:57.548893] app.INFO: [dd610cd0d21e431fafafc737c323565e] Request POST_//v1/users/login returns 404 in 530.65 ms [] []
[2021-12-20 12:45:18.556704] app.ERROR: [4018a09ea0084f9fa82f843905de2b00] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET //v1/stats/app" (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET //v1/stats/app\" at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"//v1/stats/app\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []
[2021-12-20 12:45:18.557154] app.INFO: [4018a09ea0084f9fa82f843905de2b00] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-20 12:45:18.557462] app.INFO: [4018a09ea0084f9fa82f843905de2b00] Request GET_//v1/stats/app returns 404 in 84.57 ms [] []
[2021-12-20 12:52:11.890507] app.ERROR: [5a84217237cc49e8bb9df953ac32c799] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /auth/v1/login/" (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /auth/v1/login/\" at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/auth/v1/login/\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []
[2021-12-20 12:52:11.890825] app.INFO: [5a84217237cc49e8bb9df953ac32c799] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-20 12:52:11.891043] app.INFO: [5a84217237cc49e8bb9df953ac32c799] Request GET_/auth/v1/login/ returns 404 in 84.07 ms [] []
[2021-12-20 12:52:12.088612] app.ERROR: [2b26c43f700640f190977bb797ec4448] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /favicon.ico" (from "https://192.168.88.80:31599/auth/v1/login/") (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /favicon.ico\" (from \"https://192.168.88.80:31599/auth/v1/login/\") at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/favicon.ico\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []
[2021-12-20 12:52:12.088863] app.INFO: [2b26c43f700640f190977bb797ec4448] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-20 12:52:12.089117] app.INFO: [2b26c43f700640f190977bb797ec4448] Request GET_/favicon.ico returns 404 in 82.22 ms [] []

编辑:这也是 webapp 部署的第二个副本的日志

Web server started
Starting web monitor loop ...
==> /var/log/lighttpd/error.log <==
2021-12-20 12:38:05: (server.c.1488) server started (lighttpd/1.4.55)
tail: cannot open '/var/log/whatsapp/web.log' for reading: No such file or directory
Setting up watches.
Watches established.
tail: '/var/log/whatsapp/web.log' has appeared;  following new file
[2021-12-20 12:52:24.295383] app.ERROR: [7c73b15c0a6c488fb5ac7703a4b337ec] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /teste/" (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /teste/\" at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/teste/\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []
[2021-12-20 12:52:24.302930] app.INFO: [7c73b15c0a6c488fb5ac7703a4b337ec] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-20 12:52:24.307525] app.INFO: [7c73b15c0a6c488fb5ac7703a4b337ec] Request GET_/teste/ returns 404 in 201.72 ms [] []
[2021-12-21 11:04:28.642518] app.ERROR: [7181dfea9e7b4e51adb41fc41571253f] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "POST //v1/users/login" (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"POST //v1/users/login\" at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"//v1/users/login\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []
[2021-12-21 11:04:28.644938] app.INFO: [7181dfea9e7b4e51adb41fc41571253f] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-21 11:04:28.645501] app.INFO: [7181dfea9e7b4e51adb41fc41571253f] Request POST_//v1/users/login returns 404 in 87.15 ms [] []
[2021-12-21 11:05:29.180215] app.ERROR: [8ce236970e404d7b90d86ad53e774105] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /auth/v1/login/" (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /auth/v1/login/\" at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/auth/v1/login/\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []
[2021-12-21 11:05:29.180746] app.INFO: [8ce236970e404d7b90d86ad53e774105] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-21 11:05:29.181257] app.INFO: [8ce236970e404d7b90d86ad53e774105] Request GET_/auth/v1/login/ returns 404 in 26.28 ms [] []
[2021-12-21 11:05:29.332427] app.ERROR: [feb8c3253624422383421e253fc8ce73] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /favicon.ico" (from "https://192.168.88.80:31599/auth/v1/login/") (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /favicon.ico\" (from \"https://192.168.88.80:31599/auth/v1/login/\") at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/favicon.ico\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []
[2021-12-21 11:05:29.332971] app.INFO: [feb8c3253624422383421e253fc8ce73] Response:  {"meta":{"version":"v2.37.1","api_status":"stable"},"errors":[{"code":1006,"title":"Resource not found","details":"URL path not found"}]} []
[2021-12-21 11:05:29.333465] app.INFO: [feb8c3253624422383421e253fc8ce73] Request GET_/favicon.ico returns 404 in 21.29 ms [] []

这是为 webapp 创建的服务:

NAME                       TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                               AGE
whatsapp-web-service       NodePort       10.110.67.166   <none>           443:31599/TCP                         22h

这可能是什么?

【问题讨论】:

  • 你好@ReaperClown,提供的答案对你有帮助吗?
  • 还没有@kkopczak,很确定我的问题不在 URL 上,而是在集群中的某个地方。

标签: kubernetes postman whatsapp high-availability whatsapi


【解决方案1】:

您需要生成管理员身份验证令牌才能调用 API。 我做了以下步骤,它对我有用。 注意:在这个问题上,我使用 docker-desktop 内置的 k8s 单节点集群进行 POC。

1. Download the postman collection from this link:
   https://github.com/fbsamples/WhatsApp-Business-API-Postman-Collection
2. Follow the steps in this document:
   https://developers.facebook.com/docs/whatsapp/on-premises/get-started/postman

如果它也对你有用,请告诉我。

问候,

阿罗拉王子

【讨论】:

  • 谢谢!事实证明,在 PostgreSQL 安装损坏后,我的集群搞砸了,完全重新创建集群并重新安装 WA Business API 完成了这项工作。
【解决方案2】:

看起来像一个 URL 问题。您是否检查了您正在调用的 URL? 根据您共享的链接中的文档:

"Webapp容器内的443端口映射到Kubernetes集群上的32477端口。

在使用 Postman 集合时,您需要使用 https://your-minikube-cluster-ip:your-webapp-service-targetport(例如,https://10.101.114.46:32477)作为 API 根 URL。”

但是根据您的日志,我看到使用的端口号是 31599。 https://192.168.88.80:31599/auth/v1/login/

问候, 阿罗拉王子

【讨论】:

  • 在文档中,端口 32477 是 NodePort 服务在他们的示例中分配的端口,但在我的情况下,为 webapp 服务打开的端口是 31599,事实上,如果我尝试向端口 32477 发送请求我什至根本没有得到响应,因为我的集群上的任何服务都没有使用这个端口,我在该端口上发送请求时得到:Error: connect ECONNREFUSED 192.168.88.80:32477。我也用该服务更新了我的问题。
  • 还添加了 webapp pod 的第二个副本的日志
猜你喜欢
  • 1970-01-01
  • 2021-08-16
  • 2018-08-08
  • 2019-10-02
  • 1970-01-01
  • 2021-11-09
  • 2021-05-31
  • 1970-01-01
  • 2022-06-20
相关资源
最近更新 更多