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

Refused to set unsafe header "User Agent" #27

Open
phreshsprout opened this issue Sep 29, 2022 · 10 comments
Open

Refused to set unsafe header "User Agent" #27

phreshsprout opened this issue Sep 29, 2022 · 10 comments

Comments

@phreshsprout
Copy link

Hi, your get-youtube-captions plug-in has been a great help in getting youtube transcripts into Logseq, thanks so much!

Now attempting to use the gp3 plug-in but can't seem to get it working. First was getting a 429 error, so I upgraded to a subscription with openai.. Any insight for a path forward would be appreciated.

Error-Logseq-OpenAI-plugin-Screenshot 2022-09-26 092551

@briansunter
Copy link
Owner

Hey! a 400 error means the api key might be in there incorrectly. Try double checking the API key and restarting logseq

A 429 error means rate limiting, which is an error from openai when you call them to frequently. I'll work on better handling of this error.

In the meantime, double check the API key to fix the 400s, and if you see 429s, wait a couple minutes and try again.

@cldwalker
Copy link

Hi. I'm also seeing the error Refused to set unsafe header "User-Agent" after not using the plugin for a bit. Just to be sure, I created a new API key and still the got the same 429 from openai. All the plugin configuration settings have default values e.g. text-davinci-002. Perhaps this is related to openai/openai-node#6 ? Thanks for the great plugin

@briansunter
Copy link
Owner

briansunter commented Oct 11, 2022

Hmm, I also see the unsafe header error in my console, but I get a 200 success.

Could you take a look at what the response message is for the 429 errors? Does it happen every time and consistently? Or every once in a while?

Based on looking at the openai forums, it sounds like they occasionally throw these errors for low traffic levels.

https://community.openai.com/t/server-always-results-in-429-errors-with-fine-tuned-models/21290

If you're only seeing this occasionally, I could add some retry/buffering to make the error show up to users less often. I think I may need to handle and expect this error, even for infrequent calls.

@cliffordx
Copy link

Error persist.
Screen Shot 2022-10-14 at 12 25 39 AM

@briansunter
Copy link
Owner

briansunter commented Oct 13, 2022

@cliffordx would you be able to check the error message in the networking tab?

And is it happening on every request or only occasionally?

@briansunter
Copy link
Owner

I have a fix for this here that I'm currently testing. It should help alleviate the 429 errors.

The unsafe user agent message in the logs doesn't cause any issues, so ignore it for now. I'm working on a PR to the openai SDK to fix the user agent message. I updated the readme to reflect it.

If you know how to load unpacked plugins, would be great if you could help test this build!

#29

@cldwalker
Copy link

cldwalker commented Oct 14, 2022

My 429 response contains:

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}

I looked around in the dashboard and it wasn't obvious that my quota was exceeded. Looking at https://beta.openai.com/account/api-keys doesn't indicate anything. On https://beta.openai.com/account/usage, I was able to see that my 3 month trial had ended, not that I had exceeded a quota. Perhaps this issue could just be resolved with some messaging guiding people to check if their trial has expired in addition to checking their quota

@cliffordx
Copy link

My 429 response contains:

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}

I looked around in the dashboard and it wasn't obvious that my quota was exceeded. Looking at https://beta.openai.com/account/api-keys doesn't indicate anything. On https://beta.openai.com/account/usage, I was able to see that my 3 month trial had ended, not that I had exceeded a quota. Perhaps this issue could just be resolved with some messaging guiding people to check if their trial has expired in addition to checking their quota

I can confirmed this response is similar to mine but haven't used GPT for a while.

@cliffordx cliffordx mentioned this issue Oct 14, 2022
@briansunter
Copy link
Owner

briansunter commented Oct 14, 2022

Great. Thanks for the response payload. I’m working on a change to surface those errors better. #30

@cldwalker
Copy link

New error is helpful. Thanks!

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

4 participants