project_ai_mern_image_generation icon indicating copy to clipboard operation
project_ai_mern_image_generation copied to clipboard

SyntaxError: Unexpected token 'I', "Incorrect "... is not valid JSON

Open alex-maaz opened this issue 2 years ago • 17 comments

I get this when I try to generate an image. how do I fix this? I am using the right APIs and I checked the code more than once and there is no typos and errors. Any help is appreciated, thanks.

alex-maaz avatar Jan 31 '23 22:01 alex-maaz

Use a new secret API key from Openai in the .env file.

kevmhughes avatar Feb 01 '23 01:02 kevmhughes

I did. Still not fixed

alex-maaz avatar Feb 01 '23 01:02 alex-maaz

Use a new secret API key from Openai in the .env file.

Thank you man. Had the same issue and This fixed! it for me.

LucioFider avatar Feb 02 '23 14:02 LucioFider

I am having same issue

Mohsin278 avatar Feb 04 '23 04:02 Mohsin278

I think you have typed apikey instead of apiKey in dalleRoutes openAI configurations, apiKey should be in camel case.

Azzam1503 avatar Feb 04 '23 13:02 Azzam1503

OpenAI gives $18 to new users. You have probably already spent it using one of their services. I recommend you to create another account and generate a new api key or pay to use it. Once it is set up it will not give you any more problems.

PedroLab0 avatar Feb 05 '23 11:02 PedroLab0

That's my new account and still I'm getting this error

siddharthpraja avatar Mar 19 '23 04:03 siddharthpraja

Uploading Screenshot_2023-03-19-10-09-31-44_40deb401b9ffe8e1df2f1cc5ba480b12.jpg…

siddharthpraja avatar Mar 19 '23 04:03 siddharthpraja

Same issue. apiKey is correctly typed in camelCase and my account is new, haven't exhausted the credits yet

Komal-J04 avatar Mar 28 '23 14:03 Komal-J04

I haven't found the solution yet bro but if you try Giving the API key in dallesroute and call there itself may come . Another solution is that it's not basically a solution if you use new API key it may come try it. Sorry I couldn't provide the correct solution

On Tue, 28 Mar, 2023, 7:46 pm Komal, @.***> wrote:

Same issue. apiKey is correctly typed in camelCase and my account is new, haven't exhausted the credits yet

— Reply to this email directly, view it on GitHub https://github.com/adrianhajdin/project_ai_mern_image_generation/issues/20#issuecomment-1486980830, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZGD7Q3DYL4QSO2CKNSQF23W6LXD5ANCNFSM6AAAAAAUM72MCE . You are receiving this because you commented.Message ID: @.*** .com>

srihari20031 avatar Mar 30 '23 03:03 srihari20031

Same issue. apiKey is correctly typed in camelCase and my account is new, haven't exhausted the credits yet

Thanks @Komal-J04 , It worked for me

harshit0571 avatar Mar 30 '23 16:03 harshit0571

I just want to ask that even if we want to use our free credits do we have to register our card on the site?

Saksham1005 avatar Apr 03 '23 06:04 Saksham1005

I just want to ask that even if we want to use our free credits do we have to register our card on the site?

Yes we have to add our card in. But can set the limit for your card.

harshit0571 avatar Apr 03 '23 11:04 harshit0571

i got the error SyntaxError: Unexpected token ''', "'prompt' i"... is not valid JSON, turned out my headers object has a typo

starlove54 avatar Apr 09 '23 20:04 starlove54

Having the same problem, does not figure out how to fix it :(

yashwant1711 avatar Apr 13 '23 16:04 yashwant1711

oh man, you literally are a savior. Took me 2 hours to do every stupid to complex solution just to know that it was a 'K'. wow. Thank YOU.

shailja168 avatar Jul 28 '23 20:07 shailja168

Having the same problem, does not figure out how to fix it :(

Hii,

If you are still getting the error(and in the Developer tool > Network tab > Preview if you are getting Invalid API key 401 error), then Just clear your cache and cookies(I repeat both cache and cookies) of your browser, restart your server and client. If you have generated multiple API key, then just delete the rest and use only one. if you have used the api key in some other project before then take that API key and delete the rest. It will surly work...

thisissuman avatar Aug 27 '23 03:08 thisissuman