个人案例
计算云
计算云小程序
计算云扫码体验
- 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 - 基础库 3.1.3 wx.getAccountInfo 插件版本错误
灰度的基础库 3.1.3 ,现网插件中调用 wx.getAccountInfo ,插件版本返回为 "-1.-1.-1" 。请修复。
2023-10-14 - web-view bindload src 参数为空
今天 (10.9) 下午开始, web-view bindload 函数的 src 参数开始返回空字符串 "" ,安卓 / iOS 均有报告,请问微信这边是做了变更吗?[图片]
2023-10-09 - 开发者工具插件模式找不到 wasm 包
[图片] [图片] [图片] 填写 wasm 在插件目录中的相对路径,开发者工具报找不到文件,真机表现正常。 相关问题 https://developers.weixin.qq.com/community/develop/doc/0004ee590e8c2007c97c805325b800 https://developers.weixin.qq.com/community/develop/doc/00026681da88509796eee5e6155c00 这几个都是同样的问题 麻烦帮忙确认下,谢谢
2023-01-12 - “小程序加密网络通道”是否有支持插件的计划?
参考 https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getLatestUserKey.html “小程序加密网络通道”目前尚不支持插件,但插件也有加密通信的需求。 目前插件的网络请求安全措施只有 https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html 提到的“插件请求签名”。但此签名没有对请求体进行签名,事实上攻击者可以伪造任意请求体进行重放攻击,在密码学上没有起到防篡改的作用。 请问官方是否有在插件上支持“小程序加密网络通道”的计划?谢谢!
2022-12-26 - 微信网页授权调整 变更发布计划?
参考公告 https://developers.weixin.qq.com/community/minihome/doc/000c2c34068880629ced91a2f56001 注意到 7 月 13 日左右相关变更曾经短暂上线,后续又回滚到原来的版本。 咨询下该变更是否调整了发布计划?如果调整了发布计划,是否可以透露下,以便开发者排期呢?谢谢~
2022-07-16 - 小程序 WXWebAssembly 出现 iOS 与 Android 不一致的行为
使用 rustwasm 编写简单的 wasm 代码:入参为一个 Uint8Array ,出参为一个字符串。 #[wasm_bindgen] pub fn echo(input: Vec<u8>) -> String { String::from("hello world") } 引入小程序中, Android 和 macOS 微信客户端可以正常返回 hello world 字符串,iOS 微信客户端返回为空。 跟踪调试,发现问题在于 /** * @param {Uint8Array} input * @returns {string} */ export function echo(input) { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; // 执行到这里时,cachedUint8Memory0 的大小为 wasm.memory.buffer 的大小 wasm.echo(retptr, ptr0, len0); // 执行到这里时,cachedUint8Memory0 空间被 wasm 回收,大小应为 0 // Android 和 macOS 微信客户端 cachedUint8Memory0 大小为 0 ,符合预期 // iOS 客户端似乎没能回收 cachedUint8Memory0 的空间,大小仍为执行 wasm.echo 前的值 var r0 = getInt32Memory0()[retptr / 4 + 0]; var r1 = getInt32Memory0()[retptr / 4 + 1]; return getStringFromWasm0(r0, r1); } finally { wasm.__wbindgen_add_to_stack_pointer(16); wasm.__wbindgen_free(r0, r1); } } 排查要点如上,可以看到 iOS 微信客户端的 WXWebAssembly 表现与主流浏览器不同,此问题可能导致内存访问越界进而造成微信客户端 crash (可稳定复现)。希望客户端这边能够排查,感谢~
2022-06-25 - 小程序是否有支持 TextEncoder / TextDecoder 的计划?
小程序引入 wasm 需要用到 TextEncoder 和 TextDecoder ,注意到小程序暂不支持此功能。 小程序是否有支持的计划?
2022-06-24