最开始出现的bug
进入云函数查看日志
Client platform is h5, but web was found in config
把这个问题扔到百度是没有答案的,但是找到一个类似问题 :Client platform is app, but app-plus was found in config.
顺藤摸瓜到uniCloud的官方文档 关于preferedWebPlatform
这两个示例和我的bug很像,但又完全不是一回事,照着官方文档修改一通无果。
而后发觉自己用的是VK-unicloud框架,vk对uni-id的配置也有自己的一套说法,打开VK文档uni-id的配置,发现果不其然,VK对于preferedAppPlatform的解释和写法与unicloud是完全不一致的。
最后照着vk文档顺利解决
"preferedAppPlatform": "app-plus",
"preferedWebPlatform": "h5",
"app-plus": {"tokenExpiresIn": 2592000,"oauth": {"weixin": {"appid": "微信开放平台","appsecret": "微信开放平台"},"apple": {"bundleId": "com.xxx.xx"}}
},
"h5-weixin": {"oauth": {"weixin": {"appid": "微信公众号","appsecret": "微信公众号"}}
},
"mp-weixin": {"oauth": {"weixin": {"appid": "微信小程序","appsecret": "微信小程序"}}
},