Closed XiaolongYang-HZAU closed 2 months ago
👀 @XiaolongYang-HZAU
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
@XiaolongYang-HZAU 你好!我是一个可以帮助你解决bug、回答问题并成为贡献者的机器人。如果你需要任何帮助,我会随时为你效劳。
I found a similar unsolved discussion that might be relevant to your issue: 数据库服务端部署时对接阿里云oss服务上传文件出错,求解决!!! [1].
Regarding your specific issue, the error message "fail to get image from url: 403 Forbidden" suggests that there might be an issue with the permissions or the way the URL is being accessed. Here are a few things to check and try:
CORS Configuration: Ensure that your OSS bucket has the correct CORS configuration to allow requests from your Vercel deployment. Here is an example CORS configuration for OSS:
[
{
"AllowedOrigins": ["*"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
"AllowedHeaders": ["*"],
"ExposeHeaders": ["ETag"],
"MaxAgeSeconds": 3000
}
]
Public Access: Verify that the objects in your OSS bucket are publicly accessible. Even if the bucket is set to public, individual objects might have different permissions.
Signed URLs: If you are using signed URLs for accessing the images, ensure that the URLs are correctly generated and not expired.
Environment Variables: Double-check your environment variables for OSS configuration in your Vercel deployment. Ensure that S3_ACCESS_KEY_ID
, S3_SECRET_ACCESS_KEY
, S3_ENDPOINT
, S3_BUCKET
, and S3_PUBLIC_DOMAIN
are correctly set.
Recent Changes: There have been recent changes in the codebase related to image processing and API request handling that might have introduced this issue. Notable changes include:
Error Handling: The error code count_token_messages_failed
might indicate an issue with token counting or message processing. Ensure that your API requests are correctly formatted and that the necessary tokens are being passed.
If the issue persists, you might want to look into the specific implementation of the image upload and retrieval process in the codebase, particularly when using OSS for storage. The relevant code can be found in the upload.ts
file [3] and the upload.ts
types file [4].
For more detailed configuration guidelines on S3, refer to the S3 Object Storage documentation [5].
To continue talking to Dosu, mention @dosu.
已解决,是API服务器的CF出问题了
✅ @XiaolongYang-HZAU
This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Solved. There is a problem with the CF of the API server.
📦 Environment
Vercel
📌 Version
vercel实时更新最新版
💻 Operating System
Windows
🌐 Browser
Edge
🐛 Bug Description
我的S3存储使用的是阿里云对象存储OSS。已经按照教程逐步部署,并正常使用半个月知识库和图像功能,但是今天下午开始,识图功能突然报错 { "error": { "code": "count_token_messages_failed", "type": "new_api_error", "param": "", "message": "fail to get image from url: 403 Forbidden (request id: 20240905215832296987514HIPCRXFZ)" }, "endpoint": "https://***.**/v1", #已隐去地址 "provider": "openai" } vercel后台的对应log为 [POST] /api/chat/openai status=471 Route: [openai] ProviderBizError: { message: 'fail to get image from url: 403 Forbidden (request id: 20240905220815976935078n4OV0yTD)', type: 'new_api_error', param: '', code: 'count_token_messages_failed' } 我查看了OSS的后台,发现图片是成功上传了的,且开启了公共读写,直接在浏览器打开是能够正常访问下载的,这说明上传过程没问题。我找OSS的客服帮我看着日志,我用lobe 识图请求,她说没有看到失败的请求日志,这说明API服务器没有发起正确的请求?我不知道要怎么解决。请问各路高手能否提供一些指点?
📷 Recurrence Steps
No response
🚦 Expected Behavior
No response
📝 Additional Information
No response