Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working when verifying webhook URL on LINE platform #96

Closed
wingliu0 opened this issue Dec 9, 2017 · 7 comments · Fixed by #100
Closed

Not working when verifying webhook URL on LINE platform #96

wingliu0 opened this issue Dec 9, 2017 · 7 comments · Fixed by #100
Assignees

Comments

@wingliu0
Copy link

wingliu0 commented Dec 9, 2017

Version of Bottender: "bottender": "^0.14.3",
Steps to reproduce:

  1. start the server with any endpoint eg:
    const server = createServer(bot, { path: '/webhook' });
  2. press the Verify on https://developers.line.me/console after changed a new webhook URL
  3. a mock message will be sent from LINE to our server, and it will be something like this eg:
    "events": [
        {
            "replyToken": "00000000000000000000000000000000",
            "type": "message",
            "timestamp": 1512777897980,
            "source": {
                "type": "user",
                "userId": "Udeadbeefdeadbeefdeadbeefdeadbeef"
            },
            "message": {
                "id": "100001",
                "type": "text",
                "text": "Hello, world"
            }
        },
        {
            "replyToken": "ffffffffffffffffffffffffffffffff",
            "type": "message",
            "timestamp": 1512777897980,
            "source": {
                "type": "user",
                "userId": "Udeadbeefdeadbeefdeadbeefdeadbeef"
            },
            "message": {
                "id": "100002",
                "type": "sticker",
                "packageId": "1",
                "stickerId": "1"
            }
        }
    ]
}

  1. internal/process/warning.js:18 (node:16291) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: LINE API - Not found
    this error will be logged, and it is due to the unhandled promise rejection in lib/express/createMiddleware.js:12

Is this a bug or a behavior? If it is a behavior, how can I handle the promise rejection?

@tw0517tw
Copy link
Collaborator

tw0517tw commented Dec 9, 2017

Hi @wingliu0,

Thanks for reporting. That unhandled rejection happens because bottender will try to retrieve user info from LINE with the fake user ID from this verifying request and that would fail. We should ignore these events to fix this.

You can just ignore it for now as the webhook is still set.

@wingliu0
Copy link
Author

wingliu0 commented Dec 9, 2017 via email

@tw0517tw
Copy link
Collaborator

tw0517tw commented Dec 9, 2017

@wingliu0 ,

The verification will fail, but webhook is still setup well and you will start receive events from LINE.

We will work on making that verification succeed. But before the patch been released, you can still run your bot (yes, with the failed webhook verification).

@wingliu0
Copy link
Author

wingliu0 commented Dec 9, 2017

@tw0517tw ,
But this means I cant deploy it to AWS elastic beantalk nor google app engine nor heroku

@tw0517tw
Copy link
Collaborator

tw0517tw commented Dec 9, 2017

Hi @wingliu0 ,

I'm not so familiar to AWS and GAE, but I've successfully deployed a LINE bot to Heroku with verification failing version of bottender. It'll be good if you can provide more information on why it can't be done.

In fact, you can just update the webhook URL, enter whatever you get from AWS or GAE or Heroku, but completely skip verifying on LINE developers site channel settings. That's why I said you can ignore the verification failure error.

@wingliu0
Copy link
Author

wingliu0 commented Dec 9, 2017

@tw0517tw
oh really?! I thought the verification is a must

@tw0517tw
Copy link
Collaborator

tw0517tw commented Dec 14, 2017

bottender@0.14.10 has been released, it can handle LINE webhook verify requests now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants