Froala imageUploadToS3 返回 'Parsing Response Failed' 和 Javascript
Froala imageUploadToS3 Returning 'Parsing Response Failed' with Javascript
我正在尝试使用 Froala 的 imgageUploadToS3 方法将图像放入我的 AWS 存储桶中。
整天都在为此苦苦挣扎,但进展甚微。
在我的节点环境中,我使用 Node-SDK 生成哈希:
async getHash(req, res) {
const configs = {
bucket: 'bucket',
keystart: 'deskbook-uploads/',
acl: 'public-read',
accessKey: process.env.AWS_S3_ID,
secretKey: process.env.AWS_S3_SECRET
}
const s3Hash = FroalaEditor.S3.getHash(configs);
res.json(s3Hash);
},
哈希正在到达我的客户,很酷,这里没有问题。
现在我用这个初始化 Froala 编辑器
function initializeFroala(hashedData) {
new FroalaEditor('textarea', {
theme: 'dark',
imageAllowedTypes: ['jpeg', 'jpg', 'png'],
imageUploadToS3: hashedData,
imageUploadURL: false,
events: {
},
toolbarButtons: ['fullscreen', 'strikeThrough', 'insertImage', '|',
'fontFamily', 'fontSize', 'color', 'inlineStyle', 'paragraphStyle', 'textColor', 'backgroundColor', '|', 'paragraphFormat', 'align',
'formatOL', 'formatUL', 'outdent', 'indent', 'quote', '-', 'insertLink', 'insertTable', '|',
'emoticons', 'specialCharacters', 'insertHR', 'selectAll', 'clearFormatting', '|']
});
}
现在,当我 select 插入图像按钮并制作我的 selection 时,上传栏会闪烁片刻,然后显示“解析响应失败”。
控制台显示 400 错误请求。
这是我在 S3 上的 CORS 配置。
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedOrigins": [
"http://localhost:3000"
],
"ExposeHeaders": []
}
]
我遇到了这个问题。也许我错过了一些非常简单的东西,不确定。无论哪种方式,Froala 的文档都有点困难,因为它不是最详细的。
感谢任何帮助或想法。
我在 keyStart 属性上缺少驼峰式大小写。
keyStart: 'deskbook-uploads/',
我正在尝试使用 Froala 的 imgageUploadToS3 方法将图像放入我的 AWS 存储桶中。
整天都在为此苦苦挣扎,但进展甚微。
在我的节点环境中,我使用 Node-SDK 生成哈希:
async getHash(req, res) {
const configs = {
bucket: 'bucket',
keystart: 'deskbook-uploads/',
acl: 'public-read',
accessKey: process.env.AWS_S3_ID,
secretKey: process.env.AWS_S3_SECRET
}
const s3Hash = FroalaEditor.S3.getHash(configs);
res.json(s3Hash);
},
哈希正在到达我的客户,很酷,这里没有问题。
现在我用这个初始化 Froala 编辑器
function initializeFroala(hashedData) {
new FroalaEditor('textarea', {
theme: 'dark',
imageAllowedTypes: ['jpeg', 'jpg', 'png'],
imageUploadToS3: hashedData,
imageUploadURL: false,
events: {
},
toolbarButtons: ['fullscreen', 'strikeThrough', 'insertImage', '|',
'fontFamily', 'fontSize', 'color', 'inlineStyle', 'paragraphStyle', 'textColor', 'backgroundColor', '|', 'paragraphFormat', 'align',
'formatOL', 'formatUL', 'outdent', 'indent', 'quote', '-', 'insertLink', 'insertTable', '|',
'emoticons', 'specialCharacters', 'insertHR', 'selectAll', 'clearFormatting', '|']
});
}
现在,当我 select 插入图像按钮并制作我的 selection 时,上传栏会闪烁片刻,然后显示“解析响应失败”。
控制台显示 400 错误请求。
这是我在 S3 上的 CORS 配置。
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedOrigins": [
"http://localhost:3000"
],
"ExposeHeaders": []
}
]
我遇到了这个问题。也许我错过了一些非常简单的东西,不确定。无论哪种方式,Froala 的文档都有点困难,因为它不是最详细的。
感谢任何帮助或想法。
我在 keyStart 属性上缺少驼峰式大小写。
keyStart: 'deskbook-uploads/',