[Bug]: Songs aren't added to queue
Closed this issue · 44 comments
What happened?
With the new changes to twitch chat, the songs that're being redeemed aren't being added to the queue when everything is connected.
What part of the service is not working for you?
No response
I'll take a look tomorrow. Some quick questions:
- Was this working before? You referenced some change in twitch chat.
- What is your Twitch username?
Yes it was working before the chat changes, here's an example of how it's displayed now and it not adding the song(s) to queue.
https://i.imgur.com/CHvgxHY.png
Think I found the issue maybe(?)
April 12th this was posted to the Twitch Dev change log:
The EventSub WebSockets connection URL has been updated to wss://eventsub.wss.twitch.tv/ws.
See https://discuss.dev.twitch.tv/t/update-required-for-eventsub-websockets-beta-connection-url/45079
which I might be 100% mistaken but isn't this what we use for the queue?
So, this project doesn't use websockets. It used to when I first wrote this, but I've rewritten it twice now 😅 This service just uses webhooks from Twitch, which simplifies things a lot.
I just tested with my own account and it worked just fine for me.
{"level":"info","ts":1681564750.2498934,"caller":"api/callback.go:155","msg":"User 'SaxyPandaBear' submitted '[https://open.spotify.com/track/6RAqPqijMiL2Ae7GC1FrgO?si=1ec3c22ec83d4cb5'"](https://open.spotify.com/track/6RAqPqijMiL2Ae7GC1FrgO?si=1ec3c22ec83d4cb5%27%22);}
Separate from this, when was the last time that this worked for you? I don't keep track of the contents of each submission, nor which channel they came from (not trying to start a fight over GDPR), but I do store the fact when a message comes in to my service from Twitch to queue up a song. I only have messages from before April 2nd, and one from today when I just tested it myself.
I need to figure out a better way to debug these kinds of issues.
Ah fair enough I see that's where the mixup with webhooks is apologies.
In regards to previous channel it was another channel I help manage so in this case I'm just setting up for myself this time around when I have expereicne setting up for others.
this is what it looks like when I'm trying to add songs to queue.
As you can see I have the accounts connected, TwitchSongRequests for the channel points title and I copy and paste a song url without mistake and it's not added.
Like I said, I don't see any messages that have come in, other than my one test that I did after you submitted the bug. I don't see really any activity since.
Can you open up your browser developer console (usually right click > inspect element gets you there), navigate to the local browser storage, and view your browser cookies? You should see a Twitch ID stored there. This should be 43137910
for your channel. You can verify this with the Twitch CLI, which I have set up for when I originally was testing this out:
twitch api get /users -q login=mysteriousryan
This is just to confirm whether or not you are logged in as yourself, and not someone else's channel that you manage. I don't think I anticipated someone to be a manager of multiple Twitch channels that uses my site. I could make it easier by parroting back the username of the channel that is authenticated in the UI. That's pretty doable imo.
At any rate, can you unsubscribe in the UI and reauthenticate? Part of me wonders if since you manage more than one channel, maybe it is just resubscribing to their Twitch channel points events, or is tied to their Spotify account
I confirmed with the local browser storage (Even used a separate browser altogether that was freshly installed.
So I did a quick check and it does come back as the correct ID 43137910 I did some censoring just for my own sake in case I dump something like an auth token I shouldn't.
but this is what I see https://i.imgur.com/G8gA2g3.png
I'll try again and revoke access on both Spotify & twitch and see if that'll fix it.
Update: I have unlinked & relinked both Spotify & Twitch, tried different browsers, tried playing spotify on both browser & app.
No changes.
I'm not really sure. Sounds like something is messed up with the webhook subscription. Can you set up the Twitch CLI on your computer and run the following with your Twitch ID?
twitch api get /eventsub/subscriptions -q user_id=43137910
It should not have an empty response. Outside of that all I can think of is maybe it is connected to the wrong Spotify account but idk how that would happen
Is this what you're talking about when describing "empty response"?
Yes. So you have nothing connected to your Twitch channel
Well I'm currently experiencing a new issue altogether
I revoke access on both spotify & twitch
I go to hook them up again, after that nothing appears to happen now. here's a short 20 second video
Just thought I'd jump in here to say I'm having the same issue in regards to the songs not queuing, I have linked everything and took out Spotify premium, was looking to see if I did something wrong but everything looks exactly right, happy to see the creator is still on top of this and responding.
@luke5368 Can you try setting up the Twitch CLI and then run twitch api get /eventsub/subscriptions
? Also @MysteriousRyan can you do the same? I think that having the user_id query parameter might be hiding the problem.
I'm really not sure what the issue is. I don't see any error logs. I will have to keep investigating but I've been really busy with life stuff. What makes it more confusing is that it works for me.
I ran the CLI same as before but wthout the user_id and still get the same result which is empty.
Okay thanks for trying at least. I think I need to add more logging on my end to try to see what's up. It's so weird that it works perfectly fine when I test it. My first thought was that maybe it's subscribing to my channel point events. Maybe that's the issue? Idk. I will add logging tonight or something and will @ you to try again.
Thanks so much for being patient with me through this
@MysteriousRyan okay I added a little more logging. Would appreciate if you could try the whole flow again
I've gone ahead and removed & reconnected, same issue happens in the video I sent the other day.
I don't think that you did the whole thing. You have to click the subscribe button.
I revoked my access and when I did that, I got an error:
{"level":"info","ts":"2023-04-25T01:20:11.796Z","caller":"api/eventsub.go:94","msg":"error occurred while creating EventSub subscription | HTTP 400 - Bad Request"}
So now I have something to work with. Will keep looking
in the video above, the subscribe button doesn't appear, same thing happens.
Okay that's good context. I will look into that after I fix the subscription itself. I think I identified the issue:
{"level":"info","ts":"2023-04-25T01:25:27.609Z","caller":"api/eventsub.go:94","msg":"error occurred while creating EventSub subscription | HTTP 400 | Bad Request | auth must use app access token to create webhook subscription"}
I'm not sure why you didn't get to the updated screen after authorizing.
I've tried 3 different browsers all come with the same error of not changing once both Spotify & twitch are linked.
I'm getting the issue now too. I will keep looking into it
Think I figured it out. Trying to fix it all right now bear with me. I did learn that I have something else hooked up to mine which is probably why mine always worked... I guess
@MysteriousRyan try it now. I think I fixed it.
Same issue is happening, no Subscribe button.
okay nvm I now have an issue with queueing songs. But at least I think got past the auth issue you were seeing
Do you have discord by any chance? I could try to discuss things with you on there if that's alright?
Did you revoke access? I just tried again and didn't have the issue you recorded last
Yes I revoked and reconnected both Twitch & Spotify.
Fixing a different issue now 😓 I know I fixed the issue you had. I think at this point I'm going to just wipe all of the data I have to start everyone fresh.
Here's another quick clip of me revoking and readding both Twitch & Spotify and still coming to the no subscribe button.
I just realized - you should clear your cookies for the page.
I made an update a while ago to b64 encode the twitch ID I store as a cookie. Which, ultimately doesn't really do much because it's reversible, but if your twitch ID cookie is just your raw twitch ID, it's definitely just failing to find your user.
I tried clearing the cookie, using a private window and each time unlinked & relinked, nothing changed same issue.
Okay I have fully gone through the flow and validated that it works for me. Need to figure out why you are having issues now.
Here's my discord if you use it, I'm going to be heading off for the night as it's late where I am, if you make any changes I'll read them up in the morning
Ryăn#0001
Okay there should be enough logging for me to figure something out. When you get a chance, please try in incognito mode, or just go to your local storage and delete the cookies for the site and refresh and start over.
So, to solve this, I deleted all of the user data I had. There were just things in a bad state. This resolves the issue with the UI so that the subscribe button is now visible.
Secondary problem is that Spotify restricts the users that are allowed to use my service:
{"level":"info","ts":"2023-04-25T03:34:28.193Z","caller":"spotify/playerqueue.go:47","msg":"failed to get track 43hAWgANUMvybp1zDBMrRf spotify: couldn't decode error: (46) [User not registered in the Developer Dashboard]"}
My Spotify app is still in developer mode, so for users to access it, I need to onboard them individually with a name and email.
@luke5368 @MysteriousRyan if you could provide me emails, I can add y'all as users to test it out. Separately, I've submitted my request for an extended quota. I don't know if this just lifts the restriction on onboarding users or not, so I've made more GitHub issues for me to track work on trying to simplify that onboarding process. #139 and #140
Looks like its going in the right direction now that you can see the issues too which is great, my email is victoryclasspc@gmail.com
I tried connecting it to my twitch after deleting the history and cache but its saying the below errors
failed to validate Twitch OAuth token
http: named cookie not presentFound.
Thanks again!
Yup just got the same error. I think I know what the issue is. will fix it shortly
Okay this thread has gone on for a very long time. I just tested the entire flow again and it works. I know that @MysteriousRyan confirmed that it was working for them last night after all the troubleshooting. Thanks so much for working with me through this. I made an onboarding form on GitHub in the interim while I pray that they let me give broader access without manually adding people to my service.
btw @luke5368 I added you
You genius haha, thank you! It all works great now!