这是我所做的:
- 用于 Javascript 的克隆 HMS AnalyticsKit 演示 -德国法兰克福 AWS EC2的https://github.com/HMS-Core/hms-analytics-demo-javascript.git
cd hms-analytics-demo-javascript/hmsanalyticskitdemo/
npm install
npm run dev
- 使用 Chrome 浏览器访问http://xxxx:8080 (EC2),完成测验并发布分数
- 检查控制台 - https://ibb.co/TKDm586。没有 CORS 或 401 错误。
这就是我发现的hms-analytics-demo-javascript/hmsanalyticskitdemo/src/main.js
:
var agConnectConfig =
{
"agcgw":{
"backurl": "https://lfagcgwtest01.hwcloudtest.cn:15602",
"url": "https://lfagcgwtest01cn.hwcloudtest.cn:18062"
},
"client":{
"cp_id":"4130086000000637176",
"product_id":"258913027873047688",
"client_id":"401147640282098944",
"client_secret":"ABA91A52EF1FAB651F57AF091CEC149EECAFB01757DF1224FC384D2173828480",
"app_id":"98751101985125555",
"api_key":"CgB6e3x9zs8IL+Frjllsf9DoteK4Taz7jAseM9P+ikVZBJhHu87FpdEpqq0CimpayCrJgUrkUnV2RM86fyFiD4FE"
},
"service":{
"analytics":{
"collector_url":"habackup.hwcloudtest.cn:31405,datacollector-drcn.dt.dbankcloud.cn",
"resource_id":"p1",
"channel_id":""
},
"cloudstorage":{
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
},
"ml":{
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
}
},
"region":"CN",
"configuration_version":"1.0"
};
然后我改成我自己的agconnect-services.json(注意我改了cp_id、product_id、client_id、client_secret、app_id、package_name、api_key。我的数据存放位置是德国):
var agConnectConfig =
{
"agcgw":{
"backurl":"connect-dre.dbankcloud.cn",
"url":"connect-dre.hispace.hicloud.com"
},
"client":{
"cp_id":"890001000000000000",
"product_id":"736430070000000000",
"client_id":"451560030000000000",
"client_secret":"5950F0F77523D1C95914089A046DED446E09A02036D8AAAAAAAAAAAAAAAAAAAA",
"app_id":"100000000",
"package_name":"com.aaaa.aa.aaaaaaa",
"api_key":"CgB6e3x9LNm1WQuE1uhjpEI6kdQD7xD23LfdkttRcakwi404NmcxlOBVUslatUnb5dJzXXXXXXXXXXXXXXXXXXXX"
},
"service":{
"analytics":{
"collector_url":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
"resource_id":"p1",
"channel_id":""
},
"cloudstorage":{
"storage_url":"https://ops-dre.agcstorage.link"
},
"ml":{
"mlservice_url":"ml-api-dre.ai.dbankcloud.com,ml-api-dre.ai.dbankcloud.cn"
}
},
"region":"DE",
"configuration_version":"1.0"
}
我重复了第 5 步,我看到了 CORS 错误 - https://ibb.co/HHQvMVL
POST https://datacollector-dre.dt.hicloud.com/webv3 net::ERR_FAILED
如果我在 Chrome 上打开 CORS 插件,我会看到 401 错误 - https://ibb.co/9tXMrHS
POST https://datacollector-dre.dt.hicloud.com/webv3 401
我在我的应用 > 分析 > 实时概览控制台中看不到任何分析。
我的步骤有问题吗?这可能是 API/服务器问题吗?
谢谢。