-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[Bug] 使用cloudflare的r2储存上传图片提示错误 #3413
Comments
👀 @maxage Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
一样的问题,还有ACCESS_CODE参数客户端需要手动输入下,不然直接提示无权限。 |
The same problem, and the client needs to enter the ACCESS_CODE parameter manually, otherwise it will directly prompt that there is no permission. |
我没有设置ACCESS_CODE 用的Auth0登录进去的 |
I did not set ACCESS_CODE and logged in using Auth0. |
看到大佬说过,ACCESS_CODE应该是不需要了,不过Auth0配置文档上面还写着必须。 |
I saw the boss said that ACCESS_CODE should not be needed, but the Auth0 configuration document still says it is required. |
|
|
这个是遗留 bug,会在知识库/文件上传功能发布时一并修复 |
This is a legacy bug and will be fixed when the knowledge base/file upload function is released. |
请问什么时候会发布 |
When will it be released? |
使用腾讯云COS,遇到同样问题,前端报错:
图片实际已经上传到对象存储。 |
同问,什么时候发布。毕竟这个影响日常使用了。 I have the same question - when will it be released? After all, this is affecting everyday use. |
@534002646 预计这两周吧。
@wxy-skye 如果你的使用强依赖图片上传,可以先使用客户端 db 模式 |
@534002646 I think it will take two weeks.
@wxy-skye If your application strongly relies on image upload, you can use the client db mode first |
minio 同样的问题 |
minio same problem |
@arvinxx 请问能否考虑通过环境配置在上传文件时支持path style?目前使用了virtual host形式,对动态IP的服务器来说配置会比较繁琐 具体区别如下: With virtual-host lookups, application can access the bucket as a virtual host as mybucket.minio.example.net/. |
同楼上,cloudflare tunnel 的证书只支持到二级域名,如果使用 virtual host,依赖tunnel的minio服务就无法直接使用了。如果是 Path Style 可以使用二级域名访问 |
Same as above, the cloudflare tunnel certificate only supports second-level domain names. If you use virtual host, the minio service that relies on the tunnel cannot be used directly. If it is Path Style, you can use the second-level domain name to access it. |
@briankwon path style 是啥?是 s3 标准的实现吗? |
@briankwon What is path style? Is it an implementation of the s3 standard? |
@arvinxx path style和virtual host在s3是访问bucket和object的不同方式,URL 的结构和域名解析不太一样 假设minio的域名是minio.example.net,bucket为mybucket,object为config.env,具体区别如下: 可以发现bucket的位置是不同的,一个体现在path一个体现在域名,path-style在使用更简单,而virtual-host会涉及到部署反向代理解析等问题,对于个人使用有一定成本。 可以通过amazon s3 client初始化时控制是否激活path style,关于JavaScript SDK我找到了相关文档,https://github.com/aws/aws-sdk-js-v3/blob/main/UPGRADING.md |
@arvinxx path style and virtual host are different ways to access buckets and objects in S3. The structure of the URL is different from the domain name resolution. Assume that the domain name of minio is minio.example.net, the bucket is mybucket, and the object is config.env. The specific differences are as follows: It can be found that the bucket locations are different. One is reflected in the path and the other is reflected in the domain name. Path-style is easier to use, while virtual-host will involve issues such as deploying reverse proxy resolution, which has a certain cost for personal use. You can control whether to activate path style when initializing the amazon s3 client. I found relevant documents about JavaScript SDK, https://github.com/aws/aws-sdk-js-v3/blob/main/UPGRADING.md |
minio 同样的问题 使用的版本是 1.9.6 最新版本 |
@briankwon Got it. It seems that you can add an environment variable to support this writing method. |
关于NEXT_PUBLIC_变量在DOCKER中不能自动注入NEXTJS的问题下面是一个临时的解决方法: ARG NEXT_PUBLIC_S3_DOMAIN="https://hpcow-******com" 经过测试可以解决这个问题,我这边是腾讯云做OSS所以 |
Regarding the problem that NEXT_PUBLIC_ variables cannot be automatically injected into NEXTJS in DOCKER, the following is a temporary solution:
|
部署后能够上文文件到
临时解决办法(workaround):自行build镜像,build时就把自己的 |
不错,期待官方镜像尽快把这个修复加进去 |
Not bad, I hope the official image will add this fix as soon as possible |
你这个是运行时方案还是构建时方案? |
Is this your runtime solution or build time solution? |
这个明显是构建时方案,需要用户自行build镜像的。 |
This is obviously a build-time solution that requires users to build the image themselves. |
应该算构建时方案 |
It should be considered a build-time solution |
@RidiculousBuffal 构建时方案没法做进官方镜像里的吧 |
@RidiculousBuffal The plan cannot be included in the official image when building, right? |
能不能不从环境变量中读取这个配置,换其他方案呢,比如传入一个配置文件之类,或者直接从数据库读取 |
Instead of reading this configuration from environment variables, can we use other solutions, such as passing in a configuration file or directly reading from the database? |
构建时变量和运行时变量的区别就是构建时变量是在构建阶段注入然后写死在构建产物里的,所以它没法在运行时灵活修改。 就先不用出其他主意了,这个问题我们会在知识库/文件上传的 feature 中修复掉的,耐心等待就好 |
The difference between build-time variables and run-time variables is that build-time variables are injected during the build phase and hard-coded into the build product, so they cannot be flexibly modified at run time. There is no need to come up with other ideas now. We will fix this problem in the knowledge base/file upload feature. Just wait patiently. |
已修复: #3487 |
✅ @maxage This issue is closed, If you have any questions, you can comment and reply. |
Fixed: #3487 |
📦 Environment
Docker
📌 Version
v1.9.3
💻 Operating System
Other Linux
🌐 Browser
Chrome
🐛 Bug Description
错误描述
按照要求,设置到了cloudflare的R2储存,绑定了域名。在上传图片时候提示。文件上传失败,请检查网络连接或稍后再试
详情: Error: fileEnv.NEXT_PUBLIC_S3_DOMAIN is not set while enable server upload
配置文件:
在cloudflare的R2里面也能看到通过前端上传进去的图片,但是右上角提示错误,也无法识别。
并且CORS也正确设置
[ { "AllowedOrigins": [ "https://lobechat前端访问域名", ], "AllowedMethods": [ "GET", "PUT", "HEAD", "POST", "DELETE" ], "AllowedHeaders": [ "*" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ]
The text was updated successfully, but these errors were encountered: