Got problem when test plugin in local environment

I’m having a problem with plugin local testing.
I got error that says “Failed to fetch localhost manifest. Check to ensure your localhost is running and your localhost server has CORS enabled.”

So, I also tried openai plugins quick start to what the problem is, and it throws same error.
Is there anyone who get this situation?
Thanks.

1 Like

Seems like a web server error. Try to see if you can view the manifest by browsing to http://localhost:5003/.well-known/ai-plugin.json

If not a good idea might be to upload your app on replit and give that URL to chatGPT.

Same problem. I’ve tried many days to connect to localhost but I can’t.

What browser are you using? Safari does not work for this, it has some weird local host issues.

2 Likes

Have you seen this?

cURL commands to test TODO plugin server independent of ChatGPT

1 Like

I’m trying this in Brave and it doesn’t work, even with the plugin quickstart TODO app.

hey @hwb
are you using https in the manifest url for your local testing ? Maybe change it to http see if it works ?

You use could ngrok to create a tunnel between your backend and them. This will give you an URL you can use in ChatGPT to test your local server :slight_smile:

That’s what our users do at pluginlab.ai and it works fine :slight_smile:

I used chrome and also tried safari. Both don’t work.

Unfortunately, I used ‘http’ for local testing.

Oh really! I’ll try that one. Thanks for guide.

You’re welcome.

Also, regarding your localhost problem, be sure your server allows cross-origin request made from open-ai.

I don’t know what server you run, but for example on expressjs you can install the “cors” package to allows some cross origin requests.

I adjusted the code a bit and it worked for me.

import json
import quart
import quart_cors
from quart import request

app = quart.Quart(name)
app = quart_cors.cors(app, allow_origin=“*”)

_TODOS = {}

@app.post(“/todos/string:username”)
async def add_todo(username):
req_data = await request.get_json(force=True)
if username not in _TODOS:
_TODOS[username] =
_TODOS[username].append(req_data[“todo”])
return quart.Response(response=‘OK’, status=200)

@app.get(“/todos/string:username”)
async def get_todos(username):
return quart.Response(response=json.dumps(_TODOS.get(username, )), status=200)

@app.delete(“/todos/string:username”)
async def delete_todo(username):
req_data = await request.get_json(force=True)
todo_idx = req_data[“todo_idx”]
if 0 <= todo_idx < len(_TODOS.get(username, )):
_TODOS[username].pop(todo_idx)
return quart.Response(response=‘OK’, status=200)

@app.get(“/logo.png”)
async def plugin_logo():
filename = ‘logo.png’
return await quart.send_file(filename, mimetype=‘image/png’)

@app.get(“/.well-known/ai-plugin.json”)
async def plugin_manifest():
host = request.headers[‘Host’]
with open(“./.well-known/ai-plugin.json”) as f:
text = f.read()
return quart.Response(text, mimetype=“text/json”)

@app.get(“/openapi.yaml”)
async def openapi_spec():
host = request.headers[‘Host’]
with open(“openapi.yaml”) as f:
text = f.read()
return quart.Response(text, mimetype=“text/yaml”)

def main():
app.run(debug=True, host=“0.0.0.0”, port=5003)

if name == “main”:
main()

Hi Guys, same thing is happening today for the first time, im having issues to install the plugin. I update pluygins every day. So is very rare

update plugin everyday . then it will help you to work your plugin seemlessly