Closed adzay closed 3 years ago
Hi @adzay,
this is weird indeed as it is working just normally over here.
The bearer token does not get updated automatically by updating your client secret but the token is cached for the token lifetime (expires_in
). So when your token expires (or by running php artisan cache:forget igdb_cache.access_token
) the next time you query something a fresh access token is retrieved automatically (using your new client secret).
The webhook url responded with: 405
leads me into the direction something is not working properly for how you registered the webhook url inside your application. As you might know prior to v3 of this package you needed to create a URL to handle the webhook yourself. So you may have registered it as as GET
url as the 405
error states the method it called (POST
) is not allowed.
When upgrading to v3 of this package the url registration is done automatically (but you may need to re-create your webhooks as the handling url has changed). The new automatically registered url is /igdb-webhook/handle/{endpoint}/{method}
as you may see when running php artisan route:list
.
I hope this helps. Just let me know if we may need to dig a little deeper.
Hi,
I have igdb-webhook/handle/{model}/{method}
in my route:list so that is working fine. I deleted via composer, re added and republished the config too. Also my App_URL has my live website url. Which is why after i followed your instructions last week it worked perfectly. But now i feel i am back to square one lol.
I tried your advice on the cache and it still doesnt work via CLI.
I put Game::createWebhook(Method::UPDATE);
in my homepage controller, and that does nothing too. lol i am very confused :S.
Edit: This is also the same on the live website, not just local. The commands do nothing.
Hm, weird.
When you got the Error sending test JSON, Webhook url responded with: 405
error from testing the webhook, did anything got logged into your storage/logs/laravel.log
?
Hi, Nothing in my logs at all
Well, now I'm confused as well 😅
May I ask you to create a fresh Laravel app, install the package and try registering a webhook over there? Just to make sure, there isn't something broken inside your real app.
You may bring your local test application online using https://expose.dev/ (Just make sure you enter the random url you got into your APP_URL
).
Hi I think i figured it out. So the issue is due to me changing my Twitch client key/secret (lets not go into why lol).
It looks like if the twitch client id is changed the same webhook path handle cannot be used unless you delete the original.
For example this package submitted the below url initially to register the webhook:
https://website.com/igdb-webhook/handle/games/update
After changing my Twitch id, i tried to create another webhook with the new credentioals. But the same url above was submitted. IGDB found that URL, but it had the OLD twitch id. This is why your package couldn't see/create any new webhooks.
A bit messy for me to explain but i fixed it by adding a prefix to the webhook handle
'webhook_path' => 'igdb-webhook/handle',
'webhook_path' => 'new-igdb-webhook/handle',
Obviously it may not be often someone changes their twitch id like me, but to automate, maybe you could look into generating a 6-8 letter hashID from the twich_client_id and adding it to the front of the webhook handle.
Wow! Interesting to know! Thank you for clarifying! Using a hash prefix (or suffix) is a good idea to solve this issue. I'll leave this issue open as a reminder for myself to implement this 👍🏼
Thank you!
@adzay Sooo, I've just released v3.3.0 which adds the hashed client_id
as a suffix to igdb.webhook_path
. So the new URL is https://example.com/igdb-webhook/handle/d41d8cd9/games/update
for example. The old URL without the hash remains supported but is "marked" as deprecated and will be removed in the next major release. Otherwise this release would have been a breaking change.
So in order to be ready for v4 you may recreate your webhooks now so they get generated with the new hash "syntax".
Thank you again for pointing this out! I really appreciate it!
For some reason i am only able to create Webhooks manually via postman and not through any of the methods you have listed.
This is weird because It was working after my queries last week. Which is why i closed the issues. But for some reason it stopped after taking 2 days off coding.
In my attempt to firefight i updated my client secret. Did this make things worse? Does Igdb-laravel update the bearer access code after this happens?
Also, even after i successfully created a webhook via postman, when i try to test it using the instructions here, i receive the below error.
Error sending test JSON, Webhook url responsed with: 405
There was an update to igdb last week. Was there a change in webhook handling?