I have an png uploaded to an S3 bucket with public read permissions. When I use the Messenger API to send it, I get the following error:
我有一个png上传到具有公共读取权限的S3存储桶。当我使用Messenger API发送它时,我收到以下错误:
Messenger Error received. For more information about error codes, see: https://developers.facebook.com/docs/messenger-platform/reference/send-api/error-codes { message: '(#100) Failed to fetch the file from the url', type: 'OAuthException', code: 100, error_subcode: 2018008, fbtrace_id: 'F8w/11MzB9B' }
收到Messenger错误。有关错误代码的详细信息,请参阅:https://developers.facebook.com/docs/messenger-platform/reference/send-api/error-codes {message:'(#100)无法从网址获取文件',输入:'OAuthException',代码:100,error_subcode:2018008,fbtrace_id:'F8w / 11MzB9B'}
My S3 url is in the format https://bucketname.s3.amazonaws.com/filename.png, and when I visit it, it works BUT results in auto-download. Does Messenger expect a displayed image? If so how might I change the S3 settings to permit this.
我的S3网址格式为https://bucketname.s3.amazonaws.com/filename.png,当我访问它时,它会工作,但结果是自动下载。 Messenger是否期望显示图像?如果是这样,我如何更改S3设置以允许此操作。
Thanks all!
谢谢大家!
1 个解决方案
#1
0
The problem was that Messenger doesn't accept png file types, despite me seeing examples of png's being sent in the documentation :(.
问题是Messenger不接受png文件类型,尽管我在文档中看到了png的示例:(。
Sending a jpeg instead works.
发送jpeg代替工作。
Making sure that the S3 object was uploaded with a Content-Type
specified and public read permissions (or pre-signed URL) is important.
确保使用指定的Content-Type上载S3对象并且公共读取权限(或预签名URL)非常重要。
EDIT: works but doesn't work with pre-signed requests
编辑:有效,但不适用于预先签名的请求