简体   繁体   English

用于电子邮件的 amp 中的 amp-list 组件错误

[英]amp-list component error in amp for email

I am new to AMP for Email and I am trying it out now.我是 AMP for Email 的新手,现在正在试用。 I am using the amp-list component in my email body to fetch the remote server json content.我在电子邮件正文中使用 amp-list 组件来获取远程服务器 json 内容。 But I am getting the below js error when i checked in my browser console.但是当我检查我的浏览器控制台时,我收到以下 js 错误。 Also in my Gmail inbox in the mail I received its blank.同样在我的 Gmail 收件箱中,我收到的邮件是空白的。

Uncaught (in promise) Error: Class$obf_1013: [https://dynamicmail-pa.googleapis.com/v2/xhrs:proxy?alt=protojson] ti: Unsupported HTTP status: 400: Class$obf_1011: [object Object]

template-impl.js:241 Error proxying amp-list templates: Request viewerRenderTemplate failed: Error: Class$obf_1013: [https://dynamicmail-pa.googleapis.com/v2/xhrs:proxy?alt=protojson] ti: Unsupported HTTP status: 400: Class$obf_1011: [object Object]​​​

Here are the correct headers to send for AMP to work in gmail:以下是为 AMP 在 gmail 中工作而发送的正确标头:

https://developers.google.com/gmail/ampemail/security-requirements?hl=ur#gmail https://developers.google.com/gmail/ampemail/security-requirements?hl=ur#gmail

Access-Control-Allow-Origin: https://mail.google.com
AMP-Access-Control-Allow-Source-Origin: <your sender email address>
Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin

We need to set the Content-Type & Access Control headers for CORS request like -我们需要为 CORS 请求设置内容类型和访问控制标头,例如 -

header("Content-type: application/json");
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Origin: *');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM