Webhooks cannot be created anymore ("Invalid Request" response)

Hi,

After using Asana API for more than a year there were different problems but this one with webhooks is new and I don’t know how to solve it.
Just to clarify, we already had hundreds of webhooks created so there should be no issues on our side (I hope).
We are using official Asana PHP library and when we are trying to create a new webhook after some time an error is returned: "Invalid Request":

Asana\Errors\InvalidRequestError: Invalid Request (0)
   at Asana.Client.request(\src\vendor\asana\asana\src\Asana\Errors\AsanaError.php:39)
   at Asana.Client.post(\src\vendor\asana\asana\src\Asana\Client.php:149)
   at Asana.Resources.Gen.WebhooksBase.create(\src\vendor\asana\asana\src\Asana\Resources\Gen\WebhooksBase.php:82)

In logs I can see that Asana is sending request with HTTP_X_HOOK_SECRET. So, I’ve tried to send the same request with Postman and I do receive a 200 OK response with X-Hook-Secret.

Are there any changes to webhooks or am I missing something?

Hey @Dmytro_TOLSTYI, is this still happening for you? We had some downtime early last week and I want to make sure this isn’t related to that.

If you can still reproduce this, what does the response say? (We try to send back an informative description in the response body. You can find the response data in the response instance variable on the error object.)

Hi @Matt_Bramlage.
I’m back to my PC so I can provide all the needed info.
I’ve just tried to create webhook and I still got the same issue: Asana\Errors\InvalidRequestError: Invalid Request (0).
I’m not sure that there are any additional details. This exception is being thrown in PHP Asana official lib. Error message is the same: {"message":"Invalid Request","location":"\\src\\vendor\\asana\\asana\\src\\Asana\\Errors\\AsanaError.php:39"}

Looks like the issue is with handshake part of webhook creation. I can see that Asana sends handshake GET request for which we reply with 200 code and corresponding X-Hook-Secret and empty body but webhook is not created and Invalid Request error is thrown.
We are having these issues for all our new projects.

Could anyone suggest what we can do? Is there any kind of max. number of active webhooks or something similar?

Finally, I found message in raw response. It says: The remote server did not respond within 10000 milliseconds.
Which server it means? Our server or Asana API server?

Looks like it’s the same issue as described here: Remote server timeout when creating webhooks

And, unfortunately, there’s no answer yet :frowning:

I’m still having the same issue and Asana support cannot solve it neither…

Hey @Dmytro_TOLSTYI,

Just letting you know that we haven’t forgotten you, and I’m debugging this.

Is it okay if I hit your handshake endpoint to verify it’s working? I might do so a few times through the debugging process.

Hi @Ross_Grambo. Thank you for your response and for sure, feel free to use our backend as much as needed. I would be glad to help as well if something is needed.

Hey @Dmytro_TOLSTYI,

I’m still working through this, but it’s difficult because everything appears to be working. Have you tried creating a new PAT and creating a webhook? I’m curious if the issue is somehow related to your app. (Since I can’t recreate the issue, and your handshake server looks correct.)

Let me know the results!

Hi @Ross_Grambo,

It would be really strange if this is on our side because everything was working fine for more than a year and then, suddenly, it stopped working. And, there’s the same issue reported by other user with the same error.

Aren’t you able to reproduce this issue on your side with our PAT and project ID?

P.S. I will try to create a new PAT and retry the creation process and I will let you know.

Hi @Ross_Grambo,
I’ve tried creating new PAT and creating webhook but received the same error as before.
I don’t think that it’s the issue with PAT as far as all other API requests work fine and only webhooks creation fails. Looks like it’s something with handshake request-response during the creation of webhook.
Is it possible that your server checks body of handshake response not to be empty (or, contrariwise, to be empty)? We had something like this with another API.

Yeah, creating a new PAT creates a new app (within Asana), so I was trying to rule out your app being treated differently. (Some ban or restriction I was unaware of)

I can confirm it’s not the body issue.

I can use your PAT to look up information about your requests, but we don’t use them to make requests on your behalf.

I’ll PM you with more questions.

For those who’s having the same issue: after investigation and help from Asana side and especially @Ross_Grambo it turned out that issue is with Asana internal libraries that don’t fully support HTTP 2.0 protocol.
While this issue is being fixed on Asana side a workaround is to downgrade to HTTP 1.1.
On my shared hosting it was enough to add next lines to `.htaccess. file:

Header edit Upgrade (.*)h2,h2c(.*) "$1$2"
Header edit vary (.*) "$1 do"

Thank you @Ross_Grambo for all the testing and help!

3 Likes