Description
In safari, I get this error when sending a message: failed to load resource: request header field User-Agent is not allowed by Access-Control-Allow-Headers.
The user agent header is:
- In safari:
ai-sdk/5.0.53 runtime/browser
- In chrome:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
It seems in Chrome the browser overrides the user-agent header to what it wants it to be. However in Safari it lets it be custom, which is the value that vercel ai provides.
I'm curious if this is an issue with just my specific setup with my server/usage. I wonder if https://github.com/vercel/ai-chatbot will run into this issue when it upgrades ai. I think the version that introduced the issue is 5.0.43, but ai-chatbot uses an older version.
My workaround is to delete that header key. I'm already able to do this because I'm overriding the fetch call for useChat:
useChat({ transport: new DefaultChatTransport({ fetch: async (_, init) => { ... } }) })
AI SDK Version
'ai': 5.0.53
'@ai-sdk/react': 2.0.52
Code of Conduct
Description
In safari, I get this error when sending a message: failed to load resource: request header field User-Agent is not allowed by Access-Control-Allow-Headers.
The user agent header is:
ai-sdk/5.0.53 runtime/browserMozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36It seems in Chrome the browser overrides the user-agent header to what it wants it to be. However in Safari it lets it be custom, which is the value that vercel
aiprovides.I'm curious if this is an issue with just my specific setup with my server/usage. I wonder if https://github.com/vercel/ai-chatbot will run into this issue when it upgrades
ai. I think the version that introduced the issue is 5.0.43, but ai-chatbot uses an older version.My workaround is to delete that header key. I'm already able to do this because I'm overriding the fetch call for useChat:
AI SDK Version
'ai': 5.0.53
'@ai-sdk/react': 2.0.52
Code of Conduct