project_openai_codex icon indicating copy to clipboard operation
project_openai_codex copied to clipboard

Solution 401 issue on the live deployment

Open crocmons opened this issue 2 years ago • 5 comments

Make sure that your Server folder has no gitignore file the gitignore file should be on the root folder..then it works..

crocmons avatar Dec 28 '22 08:12 crocmons

Make sure that your Server folder has no gitignore file the gitignore file should be on the root folder..then it works..

didnt work

rahul-0000-code avatar Jan 02 '23 18:01 rahul-0000-code

Make sure that your Server folder has no gitignore file the gitignore file should be on the root folder..then it works..

didnt work

@rahul-0000-code at first sign up in the OPENAI website with your Email address and password ...do the phone verification ...that gives the free trial of $18 so that you can use your api key & it don't gives you the 401 error code will perfectly works...don't use your sign up with gmail for create an account..the issue is coming because you have no balance on your account to up & running your project.

crocmons avatar Jan 02 '23 19:01 crocmons

Create another API Key and update it again it will work

kingqabil avatar Feb 11 '23 22:02 kingqabil

Create another API Key and update it again it will work

i created another api key but still it is not working

piyush-mahajan avatar Feb 15 '23 11:02 piyush-mahajan

@rahul-0000-code @piyush-mahajan, if you still getting the 401 error and you follow every step of the video, the issue could be that when he made a cut on the video at 51:59, he starts explaining how to upload to GitHub, so naturally you "git init" and then "git add ." , then at 52:15 he starts the process all over, but before "git init" he tells us to create the ".gitignore", and then "git init" again...

So because of that, Git is tracking ".env" already because of that "git init" and "git add ." at 51:59 of the video... I believe that was an error when he was editing... that could be causing your OpenAPI Key to "Rotate" and not be valid anymore for security reasons (because it's being exposed on GitHub), so if you replace the key and push your changes again the same is going to happen...

So one of the ways you can try to fix it is by running this on the root folder terminal

"git rm .env --cached" "git commit -m "Stopped tracking .env File"

now delete the ".env" file, and push your changes again, so after that git would be stopping tracking that file, and follow the rules of ".gitignore"... now you can create the ".env" file again with the new key and push the changes... (don't forget to replace the key on the server too)

I hope it helps!

willgoncdev avatar Mar 09 '23 22:03 willgoncdev