Error making localhost plugin HTTP call: TypeError: Failed to fetch

Hello! I believe I am close but when my plug in runs I get this error - it installs correctly from localhost and I have CORS accepting all; I have no other information - is this a problem with my code ?

I’m not sure about your code, but try to run the dev .env on any other place like a cloud development environment like GitHub Codespaces, Replit, or CodeSandbox.

I fixed it it was Django CORS related

It would be nice if you weren’t that guy that says “Fixed it! k’thanks bye!” What was the fix!?

1 Like

Hi could you provide more details on how you solve this? I am stuck on this issue also :smiling_face_with_tear:

In NodeJS, I have added the perfect source code to resolve it. I would be honored if it can be of help to you.

I have a dead simple endpoint “/hello”. When I hit this with POSTMAN I get the following result from my webserver:

bwj@MacBook-Air ~ % http :8080/hello

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: false
Access-Control-Allow-Headers: Content-Type, Authorization, openai-conversation-id, openai-ephemeral-user-id
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Origin: https://chat.openai.com
cache-control: no-store, max-age=0
content-length: 27

{ “answer”: “Hello World” }

My plugin registers just fine with ChatGPT for local plugin development (Beta) but when I tell chatgpt something simple like “get hello endpoint” I get the above error message “failed to fetch” (as shown in the subject of this post). My logs show that NO request is being made by ChatGPT to my localhost webserver. I’m using Chrome as my browser. What else can I try?

SOLVED: Using ngrok.com to tunnel my localhost webserver out to the world solved the issue. Be warned that with the free account at ngrok, every time you visit your “public” facing url (that is tunneled down to your localhost web server) you will get prompted with a warning page that you have to click through to access any of your endpoints. This trips up ChatGPT. The easiest way to fix this is to purchase a paid ngrok plan to remove that interruption. ChatGPT then worked fine.