suno-api icon indicating copy to clipboard operation
suno-api copied to clipboard

Cookie/session error

Open Ippephyx opened this issue 1 year ago • 12 comments

Hi !

Thanks a lot for this API. I used it for about a week without a single problem. But since friday, without modifyin anything, I' can't seem to be able to get a session id :² {"error":"Internal server error. Error: Failed to get session id, you may need to update the SUNO_COOKIE"}

I've tried updating the SUNO cookie locally (export ...) and system wide (editing /etc/environment) but, still the same error. I've notice that the cookie now starts with "__cf_bm=" instead of "__client=" , µI dont know if that might be the source of the problem... ?

Thanks a lot.

Ippephyx avatar May 27 '24 12:05 Ippephyx

Okay, I may have a brief vacation next week, I will make time to deal with it.The new product has taken up all my time recently, I need to find a gap, although slowly, I will continue to maintain it.

blueeon avatar May 28 '24 07:05 blueeon

Thank you so much for you reply. Should you need help or testing, do not not hesitate.

Ippephyx avatar May 28 '24 07:05 Ippephyx

I am being troubled by the same issue.

haiweizhu avatar Jun 05 '24 08:06 haiweizhu

heeey bois, I had the same problem and it somehow works now. So I went into settings and environment variables and I had replaced them with the one in here: tokens?_clerk_js_version=4.73.2 And then I saved the changes. Then I went and redeployed my old deployment of the SUNO API app (I think environment variable changes only take effect on redeployment, im not sure) And then it worked using /api/get_limit.

Sooo get a new cookie and redeploy the entire thing after changing the environment variable. This worked for me, but I hope it works for you as well!

ihebsalah avatar Jun 05 '24 15:06 ihebsalah

I’m not sure if you modified the cookie in Vercel and didn’t redeploy. Is that so? Please give me some feedback. @Ippephyx @haiweizhu @ihebsalah

blueeon avatar Jun 08 '24 05:06 blueeon

Yes, so originally the vercel App was working using the old cookie method. Then it broke down, I tried to change the SUNO_COOKIE environment variable WITHOUT redeploying, and it never worked that way. ( I came from Azure where changing the environment variable works without redeploying )

Then I used the value inside of here: tokens?_clerk_js_version=4.73.2 to change the environment Variable. Then I actually redeployed this time and it worked.

So I am not sure if this: "tokens?_clerk_js_version=4.73.2" exact cookie made it work, I have not tested if the other values work, but eh just try. So my biggest mistake was actually not redeploying after changing the cookie value. And if it didnt work with the normal cookie just give this a try: tokens?_clerk_js_version=4.73.2. Maybe it works too.

ihebsalah avatar Jun 09 '24 13:06 ihebsalah

Is your product sumosuno.com? Seems like they provide a Suno API out of the box

FergaliciousPixelicious avatar Jun 19 '24 02:06 FergaliciousPixelicious

Is your product sumosuno.com?

are you talking about me? xD if so thanks for asking. no that was not my product, but im using this API in an autonomous software development system. I know it's quite optimistic to make ai do the entire process of software development, but it is displaying quite good results for ai you know xD.

So I am using this so that my agents can generate music and add it to their apps. Soo the system itself is almost done cooking :D. So quite literally what Devin AI wanted to be.

ihebsalah avatar Jun 19 '24 14:06 ihebsalah

Ill tell you my experience. I built an app on top of this api. And the cookie has been my biggest nightmare since. I didnt know there was any other way to update the cookie other than grabbing it from the google console and redeploying. These cookies may expire without any warning. I believe SUNO releases affect to them, because i got these cookies expired in 2 days, 8 days, 1 day, without a clear pattern.

I doubt there is any way to refresh this cookie automatically, since you need to login through google with your credentials, and that part I couldn´t automate. But if there is any way to do this, please share. Because every time the cookie goes nuts, all music generation on my app goes down. 😥

cmarrades avatar Jun 29 '24 08:06 cmarrades

Yeee you could probably find a way to control vercel through an API and automatically fetch the token using some kind of backend browser, every time it expires

Now I would rather have a version of the suno API wrapper that runs locally on my machine for this (best would be using a library that you could import to avoid redeployment), as you would probably have to wait a bit for the vercel app to redeploy.

Try with Claude sonnet 3.5 and not gpt 4o to make this. You can also try logging in using discord or Microsoft account if Google doesn't work. But I'm not sure as to how possible that is because I never tried.

But yeah I also gave up on music generation because of the cookie situation. I still think this is lose lose for suno ai. They could be making more money with this. They should facilitate the usage of their technology in my opinion. But maybe their focus is on normal consumers that use their apps

ihebsalah avatar Jun 29 '24 11:06 ihebsalah

I would also like to know if there is anything you can do to deal with this suno cookie expiring at random times.

jochemstoel avatar Jul 09 '24 10:07 jochemstoel

same as above comment

hovanhoa avatar Jul 29 '24 04:07 hovanhoa