Hi, developers.
I am trying to dev GPTs with Action. As the first one, I have prepared GPT connecting with NewsAPI.
However, the GPT keep encountering error 400 which says “userAgentMissing”.
I have no idea how to be managed userAget set and there is no option to configure it in GPT builder.
I have tried including custom userAgent setting into schema, however GPT builder did not accept that showing the following error message.
"In path /everything, method get, operationId searchNews, parameter User-Agent has location header; ignoring"
Here is debugging log on GPT builder test API connection.
I have the same issue with the NewsAPI.
This is what GPT told me:
“As a language model, I don’t have the capability to make external HTTP requests or access logs. Therefore, I can’t provide you with actual headers or logs of any requests.”
So, it seems like the User-Agent is set outside of the GPT scope. I have no idea how to fix it.
@typo.3
Hi, thank you for the comment. I am suspicious there are some kind of problem inside the system of GPTs, so that I just left this night and I tried again just now but the result was the exact same.
GPT test execution reported 400 “userAgentMissing”.
Before trying newsapi, I have tested other service’s API which does not require Authorization process and just simply acquires information by GET method.
That works. Therefore, of-course there are a kind of some issues relating Authorization.
I have not addressed the cause yet, though… anyway thanks for your info.
Hey there! The News API you’re using requires all incoming requests include a User-Agent header. Without seeing your action schema directly, it looks like you’re probably hitting the API directly.
Essentially, in the background when you ask ChatGPT to contact the News API, it makes a request to the API on the backend. Right now, the request that ChatGPT is making doesn’t include a User-Agent header, but the News API wants one, which is causing the error you’re seeing.
Unfortunately, ChatGPT doesn’t seem to support the headers field in OpenAPI yet, so you’re going to have to create a proxy around the News API. You might be able to use something like Cloudflare Workers for this; all you’ll need to do is forward on requests and add a User-Agent header to them with the User Agent you want. I don’t have the time to explain how to do this, but there’s lots of documentation around that for Cloudflare Workers.
Anyway, I can confidently tell you that this isn’t an issue with authorization or ChatGPT; your Action just isn’t forming the requests in the format that the News API is expecting and you’ll need to take action to fix that
@huwsername
Thank you for the very important info. That made me understood the situation.
I am sure there must be some kind of proxy to fill the requirement of NewsAPI, yes confirmed. Btw, I am wondering why GPTs not support UA param somehow, because UA is the important factor for communication between systems as common.
If I had to guess, it looks like the GPT Actions feature has been designed for developers to integrate their own products with ChatGPT, rather than for developers to integrate other people’s products. It’s also a fairly new product and they haven’t yet added a lot of functionality, just the basics to get started with.