Open yeetmaster69 opened 4 months ago
I have the same problem. Returns Error data: {"error": "Internal server error: undefined"} (my personal logs) even though the /api/get_limit endpoint works for the vercel server I'm using.
@yeetmaster69 @Exoplanetarium The /api/generate
request handles "prompt" and other parameters in its body, not in the endpoint. Probably you should try including "prompt", booleans for "make_instrumental" and "wait_audio" in the request body.
Check src/app/api/generate/route.ts
This is my steup for /api/generate
, which used to work:
const url = "https://suno-api-three-xi.vercel.app/api/generate"; // not real deployment url
const headers = { "Content-Type": "application/json" };
const payload = {
prompt,
make_instrumental: instrumental, // instrumental is a prop that is always Boolean
wait_audio: false,
};
...
const response = await axios.post(url, payload, { headers });
As of about last week, it seems to have stopped working and returned this undefined error. I have tried taking only the _client
part of the cookie and redeploying, using a different account cookie, and logging each prop to make sure they are of the correct type.
@Exoplanetarium the /api/generate
works as expected right now if you properly set the SUNO_COOKIE
in the .env
file. You may check correctness of SUNO_COOKIE
by calling api/get_limit
query, and in case it returns 500, you're most likely to have an invalid cookie set in the .env
file.
I myself found a way to troubleshoot this by logging in to the proper account on suno.com, then finding and setting the cookie in the .env
file so the file looks like this: SUNO_COOKIE=__client=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.ey ...the remaining part of the cookie...
@karpoveech I checked the /api/get_limit
query and it returned
{
"credits_left": 50,
"period": null,
"monthly_limit": 50,
"monthly_usage": 0
}
so it should work, but calling /api/generate
returns the 500 error: undefined. I'm deploying this api on Vercel, so maybe that causes issues?
Update: I looked into the Vercel logs but all I could get was Error generating custom audio: ""
@Exoplanetarium commit here 14e843a should fix the error logging for you. In the current API version it logs Error generating custom audio
every time it encounters any error but without any description. Now I extended this log so it contains the error message and returns this error message in the query response as well
Thank you for that commit, I've added it to my clone of suno-api. Now it gives me the Error: Failed to get session id, you may need to update the SUNO_COOKIE
. However, I'm still not sure how to resolve the error, I've tried many different sections of the cookie including inserting everything after __client
but it hasn't worked so far. What part of the cookie works?
Make sure you have only one .env
file in the repository root. As for the cookie itself, as I've said before, the contents of the .env
file should look like this: SUNO_COOKIE=__client=ey.............ey..............tm..........
. Instead of dots, these should be symbols, my cookie string is more than 500 chars long without __client=
.
Note that cookie must not contain the ;
symbol which you might've accidentally copied from the browser's dev tools. You can decode the cookie at https://jwt.io and see if it's malformed.
I don't see any other reasons the API isn't working for you
Unfortunately, nothing you've suggested has worked. The closest I got was a cookie the api did accept (/api/get_limit
returned non-error) but I received a 403 Error when trying to call /api/generate
. I literally have no idea why or how this is happening, and I would appreciate other perspectives on my problem from the other devs to help me debug.
Same error with me, not working for me.
Same error with me,:( can Get but can't Post。
It is possible that the account has been banned. I couldn't create it successfully on the official website today.
Yes @wocall you are right account has been banned . I tried three different account all banned . After 7 days .
I just deployed to vercel and am trying to call a POST request to /api/generate. Vercel logs say "TypeError: Cannot read properties of undefined (reading 'data')"
To Reproduce Steps to reproduce the behavior:
Expected behavior The response should have been successful
Screenshots
Made request using POSTMan and tried from my machine as well.