question

bitshake avatar image
bitshake asked

Webhooks not being called

I just created a rest service in my server that accepts the PlayStream events and puts them in my database. I simply decode the events from POST, see if it's an array of them or if it's a single one, and insert them in a database. I also log any access to the service into a log file.

I've configured my webhook (I only have 1 in the free account) for any event to send it to that rest service. I should be receiving a request there with the events I'm getting in PlayStream right? Or am I missing something?

webhooks
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

If you have configured a webhook in our analytics service, 100% of events received in your title will result in calls to your endpoint. If your endpoint fails the call or fails to respond, there will be retries, but if that goes on for more than a few minutes, the event will be dropped.

10 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bitshake avatar image bitshake commented ·

Might be useful in the future (if possible) to send it since most Apache servers using mod sec will have issues with it. I ended up asking my provider to disable that rule for that service and its working now.

Thanks a lot for your help! And happy holidays!

1 Like 1 ·
Toni Palm avatar image Toni Palm bitshake commented ·

Content-Type header is definitely needed with the webhooks @Brendan. I am currently struggling to get Google Cloud Functions to receive anything because of the missing header.

0 Likes 0 ·
brendan avatar image brendan Toni Palm commented ·

We do have an open backlog item on this. If your use case is not high-volume, in terms of events, you may want to consider using a triggered Cloud Script to make the call to GCF.

0 Likes 0 ·
bitshake avatar image bitshake commented ·

Hellp Brenda. Thanks for the reply.


But my endpoint is not receiving them. Is there any way I can confirm you're sendind the events? Or to confirm the call failed? I see in the documentation a counter of failed calls but I don't see it in my Playfab account.

0 Likes 0 ·
brendan avatar image brendan bitshake commented ·

If you have a webhook configuration set, and it is for all events, an attempt will be made to send every event to it. We have quite a few titles using this, so if it wasn't working, we'd be getting alerts. Can you let us know your Title ID, so that we can have a look at the specifics of your case?

0 Likes 0 ·
bitshake avatar image bitshake commented ·

Of course. It's B09D.

To test my endpoint I'm using postman to POST a Content-type: application/javascript with this req in the body:

{ "EventName": "game_over", "EventNamespace": "title.B09D", "Source": "B09D", "EntityType": "player", "TitleId": "B09D", "EntityId": "66C3A076AEBF3AD1", "EventId": "92540e3edbae43ce8197e259fd88166d", "SourceType": "GameClient", "Timestamp": "2018-12-10T00:30:29.8773809Z", "History": null, "CustomTags": null, "Reserved": null, "PlayFabEnvironment": { "Vertical": "master", "Cloud": "main", "Application": "mainserver", "Commit": "2e565ff" }, "level": 59 }

And it works. I also tested it with 2 requests in an array (so [ request1, request2]) and it also works.

Am I doing something wrong?

Thanks a lot for your help.

0 Likes 0 ·
brendan avatar image brendan bitshake commented ·

I just swapped your webhook config to point to a temporary webhook at webhook.site, and confirmed that the events are being sent to that endpoint. I left it set up that way, in case you want to try it out yourself (though depending on how long it is before you test, you may need to generate a new temporary endpoint).

0 Likes 0 ·
bitshake avatar image bitshake commented ·

Oh, this is a great way for me to test this. Thanks! I'm seeing them working. This makes it easier for me to debug this. Thanks for your time!

0 Likes 0 ·
bitshake avatar image bitshake commented ·

Ok, I finally got my host to give me access to the errors (I'm going to get a new host). It seems the problem is a mod security in apache that prevents access by requests that don't have a Content-type header. Can you confirm that the webhooks requests you guys send don't have it? Thanks!

0 Likes 0 ·
brendan avatar image brendan bitshake commented ·

Looking at the webhook.site info (and re-testing with RequestBin), that's correct - there's no Content-Type header on the POST.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.