个人案例
计算云
计算云小程序
计算云扫码体验
- iOS WebAssembly 出现 CompileError: invalid wasm file
使用 rustwasm 编写简单的 wasm 代码:测量数组长度 use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn length(input: &[u8]) -> usize { input.len() } wasm-bindgen 版本为 0.2.100 Android, Windows, macOS 客户端表现均正常, iOS 客户端在 WXWebAssembly.instantiate 处报错 {message: "CompileError: invalid wasm file", line: 1, column: 277, stack: "@[native code]↵@↵L@https://lib/WAServiceMainContext.js:1:334105↵@↵MQe@https://lib/WAServiceMainContext.js:1:2205032↵@https://usr//appservice.app.js:57:44↵h@https://lib/WAServiceMainContext.js:1:41859↵_callee$@https://usr//appservice.app.js:69:30↵@https://usr//appservice.app.js:6:2617↵h@https://lib/WAServiceMainContext.js:1:41859↵s@https://usr//appservice.app.js:6:2862↵@https://usr//appservice.app.js:6:8228↵h@https://lib/WAServiceMainContext.js:1:41859↵_tmp12@https://usr//appservice.app.js:6:8660↵@https://usr//appservice.app.js:6:4396↵h@https://lib/WAServiceMainContext.js:1:41859↵@https://usr//appservice.app.js:6:4458↵@https://usr//appservice.app.js:3:466↵h@https://lib/WAServiceMainContext.js:1:41859↵asyncGeneratorStep@https://usr//appservice.app.js:3:757↵@https://usr//appservice.app.js:3:1470↵h@https://lib/WAServiceMainContext.js:1:41859↵c@https://usr//appservice.app.js:3:1527↵@https://usr//appservice.app.js:3:1763↵h@https://lib/WAServiceMainContext.js:1:41859↵@https://usr//appservice.app.js:3:1802↵j@https://lib/WASubContext.js:1:59069↵@https://usr//appservice.app.js:3:1152↵h@https://lib/WAServiceMainContext.js:1:41859↵_tmp3@https://usr//appservice.app.js:3:1863↵@https://usr//appservice.app.js:71:20↵h@https://lib/WAServiceMainContext.js:1:41859↵_wbg_load@https://usr//appservice.app.js:72:22↵@https://usr//appservice.app.js:47:20↵h@https://lib/WAServiceMainContext.js:1:41859↵__wbg_load@https://usr//appservice.app.js:48:22↵@https://usr//appservice.app.js:112:29↵h@https://lib/WAServiceMainContext.js:1:41859↵_callee2$@https://usr//appservice.app.js:122:31↵@https://usr//appservice.app.js:6:2617↵h@https://lib/WAServiceMainContext.js:1:41859↵s@https://usr//appservice.app.js:6:2862↵@https://usr//appservice.app.js:6:8228↵h@https://lib/WAServiceMainContext.js:1:41859↵_tmp12@https://usr//appservice.app.js:6:8660↵@https://usr//appservice.app.js:6:4396↵h@https://lib/WAServiceMainContext.js:1:41859↵@https://usr//appservice.app.js:6:4458↵@https://usr//appservice.app.js:3:466↵h@https://lib/WAServiceMainContext.js:1:41859↵asyncGeneratorStep@https://usr//appservice.app.js:3:757↵@https://usr//appservice.app.js:3:1470↵h@https://lib/WAServiceMainContext.js:1:41859↵c@https://usr//appservice.app.js:3:1527↵@https://usr//appservice.app.js:3:1763↵h@https://lib/WAServiceMainContext.js:1:41859↵@https://usr//appservice.app.js:3:1802↵j@https://lib/WASubContext.js:1:59069↵@https://usr//appservice.app.js:3:1152↵h@https://lib/WAServiceMainContext.js:1:41859↵_tmp3@https://usr//appservice.app.js:3:1863↵@https://usr//appservice.app.js:124:20↵h@https://lib/WAServiceMainContext.js:1:41859↵_wbg_init@https://usr//appservice.app.js:125:23↵@https://usr//appservice.app.js:96:20↵h@https://lib/WAServiceMainContext.js:1:41859↵__wbg_init@https://usr//appservice.app.js:97:23↵@https://usr//pages/index/index.appservice.js:18:67↵h@https://lib/WAServiceMainContext.js:1:41859↵_callee$@https://usr//pages/index/index.appservice.js:28:32↵@https://usr//appservice.app.js:6:2617↵h@https://lib/WAServiceMainContext.js:1:41859↵s@https://usr//appservice.app.js:6:2862↵@https://usr//appservice.app.js:6:8228↵h@https://lib/WAServiceMainContext.js:1:41859↵_tmp12@https://usr//appservice.app.js:6:8660↵@https://usr//appservice.app.js:6:4396↵h@https://lib/WAServiceMainContext.js:1:41859↵@https://usr//appservice.app.js:6:4458↵@https://usr//appservice.app.js:3:466↵h@https://lib/WAServiceMainContext.js:1:41859↵asyncGeneratorStep@https://usr//appservice.app.js:3:757↵@https://usr//appservice.app.js:3:1470↵h@https://lib/WAServiceMainContext.js:1:41859↵c@https://usr//appservice.app.js:3:1527↵@https://usr//appservice.app.js:3:1763↵h@https://lib/WAServiceMainContext.js:1:41859↵@https://usr//appservice.app.js:3:1802↵j@https://lib/WASubContext.js:1:59069↵@https://usr//appservice.app.js:3:1152↵h@https://lib/WAServiceMainContext.js:1:41859↵_tmp3@https://usr//appservice.app.js:3:1863↵@https://usr//pages/index/index.appservice.js:29:56↵h@https://lib/WAServiceMainContext.js:1:41859↵onLoad@https://usr//pages/index/index.appservice.js:30:24↵@https://lib/WASubContext.js:1:452622↵@https://lib/WASubContext.js:1:452415↵@https://lib/WASubContext.js:1:464587↵@https://lib/WASubContext.js:1:424215↵@https://lib/WASubContext.js:1:465128"} 请帮忙看看,谢谢~
01-18 - PC OpenSDK 无法初始化,报错 Cannot read properties of null
按照文档指示引入 PC OpenSDK https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_PC_APIs/guideline.html 报错 [图片] 复现代码 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Weixin</title> <script type="text/javascript" src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxopensdk.js"></script> <script type="text/javascript"> async function dosomething() { const response = await fetch("https://api.example.com/open/wx/ticket", { method: "GET", }) if (!response.ok) { return } const { ticket } = await response.json(); const wxres = await wxopensdk.launchMiniProgram({ appid: "wx", userName: "gh_", path: "pages/", ticket: ticket, }); console.log(wxres); } if (wxopensdk.ready) { console.log("wxopensdk is ready"); dosomething(); } else { console.log("wxopensdk is waiting"); wxopensdk.onReady = dosomething; } </script> </head> <body> <h1>haha</h1> </body> </html>
01-11 - WXWebAssembly.instantiate 偶现异常
小程序在插件中使用 WebAssembly ,iOS 偶现 WXWebAssembly.instantiate 异常。 插件侧代码如下: async function __wbg_init() { if (wasm !== undefined) return wasm; const imports = __wbg_get_imports(); const { instance, module } = await WXWebAssembly.instantiate('utils/crypto.wasm.br', imports); return __wbg_finalize_init(instance, module); } 报错如下: @[native code] @ N@https://lib/WAServiceMainContext.js:1:72514 @ @https://lib/WAServiceMainContext.js:1:1847563 s@https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1099:742 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1099:2076 asyncGeneratorStep@https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:58 c@https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:295 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:371 j@https://lib/WASubContext.js:1:72523 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:228 s@https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1099:742 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1099:2076 asyncGeneratorStep@https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:58 c@https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:295 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:371 j@https://lib/WASubContext.js:1:72523 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1092:228 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1106:105 @https://lib/WASubContext.js:1:514035 runWith@https://lib/WASubContext.js:1:509465 S@https://lib/WASubContext.js:1:514019 @https://usr//__plugin__/wxebbb8eded25ba277/appservice.js:1126:17 @https://usr//appservice.app.js:17:257 @https://lib/WASubContext.js:1:520013 runWith@https://lib/WASubContext.js:1:509465 V@https://lib/WASubContext.js:1:519997 r@https://lib/WASubContext.js:1:518810 @https://usr//appservice.app.js:21:228 @https://lib/WASubContext.js:1:520013 runWith@https://lib/WASubContext.js:1:509465 V@https://lib/WASubContext.js:1:519997 @https://lib/WASubContext.js:1:511930 forEach@[native code] flushQueue@https://lib/WASubContext.js:1:511910 @https://lib/WAServiceMainContext.js:1:2313942 n@https://lib/WAServiceMainContext.js:1:111478 Le@https://lib/WAServiceMainContext.js:1:111551 Le@[native code] @https://lib/WAServiceMainContext.js:1:2313845 @https://lib/WAServiceMainContext.js:1:2309616 @https://lib/WAServiceMainContext.js:1:625253 emit@https://lib/WAServiceMainContext.js:1:630749 @https://lib/WAServiceMainContext.js:1:1097032 @https://lib/WAServiceMainContext.js:1:622076 @https://lib/WAServiceMainContext.js:1:613026 emit@https://lib/WAServiceMainContext.js:1:119174 emit@[native code] emit@https://lib/WAServiceMainContext.js:1:118793 subscribeHandler@https://lib/WAServiceMainContext.js:1:122317 排查后推断报错与业务无关,烦请排查下 WXWebAssembly.instantiate 的实现,谢谢
2024-03-20