Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #2

Closed
BEaXt7f97 opened this issue Nov 19, 2023 · 1 comment
Closed

Error #2

BEaXt7f97 opened this issue Nov 19, 2023 · 1 comment

Comments

@BEaXt7f97
Copy link

Any idea? MacOS 14

TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
    at new NodeError (node:internal/errors:405:5)
    at Function.byteLength (node:buffer:787:11)
    at safeCompare (/Users/[user[Downloads/GPTPortal-main/node_modules/express-basic-auth/index.js:9:33)
    at staticUsersAuthorizer (/Users/USER/Downloads/GPTPortal-main/node_modules/express-basic-auth/index.js:42:43)
    at authMiddleware (/Users/USER/Downloads/GPTPortal-main/node_modules/express-basic-auth/index.js:61:18)
    at Layer.handle [as handle_request] (/Users/m1/Downloads/GPTPortal-main/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/USER/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:328:13)
    at /Users/m1/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/Users/m1/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/USER/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:280:10)
@Zaki-1052
Copy link
Owner

Zaki-1052 commented Nov 19, 2023

It looks like you may have forgotten to set up HTTP Authentication in the Environment Variable. Currently, the file is called .env.example, while the script is looking for .env. For both your OpenAI API key and the secure login, you'll need to open a text editor (VS Code, Sublime, any other IDE), and either modify the name of the file or creative a new one called .env. From the ReadMe:

  1. Set Up Environment Variables:
    • Create a .env file in the root directory.

      • Format shown in .env.example
    • Add your OpenAI API key and basic authentication:

       OPENAI_API_KEY=your_api_key_here
       USER_USERNAME=Username
       USER_PASSWORD=Password

If you're simply using Finder and want to use the default TextEdit, find the folder, use the shortcut CMD+Shift+. to show the hidden environment variable file. Then rename it to .env. The default is simply "Username" and "Password"; to customize it, double click/open the .env or .env.example and replace the values with whatever you'd like to sign in as. The Portal runs locally on your computer's port, so all the Basic HTTP Authentication is doing is securing the server for you. The more important part is adding your API key to the file so that it communicate with GPT-4.

I made a quick tutorial that you can follow the steps of if you're confused; it's just some extra setup so you can be sure no one's accessing your API key, as you choose the login credentials.

Video Showcase - Instructions

The timestamp is at 2 minutes and ends at 3 minutes: https://youtu.be/v3GVu0ZuXk4?si=yPoRNdIfJ25-ZHpo&t=119

Clip: https://youtube.com/clip/UgkxQl6762PzwyHpZ4ial0lrzLRjZecMxR5-?si=yWr1C5QYtE7k1eIM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants