adrianhajdin / project_ai_mern_image_generation

Build and Deploy a Full Stack MERN AI Image Generation App MidJourney & DALL E Clone
https://jsmastery.pro
1.09k stars 303 forks source link

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

Open alex-maaz opened 1 year ago

alex-maaz commented 1 year ago

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.

kevmhughes commented 1 year ago

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

alex-maaz commented 1 year ago

I did. Still not fixed

LucioFider commented 1 year ago

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.

Mohsin278 commented 1 year ago

I am having same issue

Azzam1503 commented 1 year ago

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

PedroLab0 commented 1 year ago

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.

siddharthpraja commented 1 year ago

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

siddharthpraja commented 1 year ago

# ![Uploading Screenshot_2023-03-19-10-09-31-44_40deb401b9ffe8e1df2f1cc5ba480b12.jpg…]()

Komal-J04 commented 1 year ago

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

srihari20031 commented 1 year ago

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>

harshit0571 commented 1 year ago

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

Saksham1005 commented 1 year ago

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?

harshit0571 commented 1 year ago

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.

starlove54 commented 1 year ago

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

yashwant1711 commented 1 year ago

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

shailja168 commented 1 year ago

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.

thisissuman commented 1 year ago

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...