import ci from 'miniprogram-ci';
try {
const project = new ci.Project({
appid: `${appid}`,
type: 'miniProgram',
projectPath: 'packages/xx',
privateKeyPath: `${pkp}`,
ignores: ['node_modules/**/*']
});
smBuffer = await ci.getDevSourceMap({
project,
robot: 30,
sourceMapSavePath: './sm.zip'
});
} catch (e) {
console.log('拉取 sourcemap 文件失败', e);
return;
}
报错内容
拉取 sourcemap 文件失败 Error: request failed, errCode: -1, errMsg: get new ticket fail innerCode: -80014
at getDevSourceMap (/Users/xx/.jenkins/workspace/xx/marsenal/node_modules/miniprogram-ci/dist/ci/getDevSourceMap.js:2:1578)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.getDevSourceMap (/Users/xx/.jenkins/workspace/xx/marsenal/node_modules/miniprogram-ci/dist/utils/report.js:2:1403)
at async step.rule (file:///Users/xx/.jenkins/workspace/xx/marsenal/src/build-deploy.pipeline.js:461:24)
at async step (file:///Users/xx/.jenkins/workspace/xx/marsenal/node_modules/@xx-client/marsenal-js/dist/main.js:57170:5)
at async file:///Users/xx/.jenkins/workspace/xx/marsenal/src/build-deploy.pipeline.js:446:1
问题已解决,最终发现是由于sourcemap 体积太大(约 200M)导致下载失败。通过开启 `streaming` 配置解决。
详见小游戏的文档
https://developers.weixin.qq.com/minigame/dev/devtools/ci.html#%E6%8B%89%E5%8F%96%E6%9C%80%E8%BF%91%E4%B8%8A%E4%BC%A0%E7%89%88%E6%9C%AC%E7%9A%84sourceMap
而小程序的文档里却没有这个配置,太坑了
https://developers.weixin.qq.com/miniprogram/dev/devtools/ci.html#%E6%8B%89%E5%8F%96%E6%9C%80%E8%BF%91%E4%B8%8A%E4%BC%A0%E7%89%88%E6%9C%AC%E7%9A%84sourceMap
之前社区有同样错误码的问题反馈,
https://developers.weixin.qq.com/community/develop/doc/0002ea0cbe4f387d50ebeb44251c14?_at=1727232450117
官方说在1.2.3 版本解决了,但是查看 miniprogram-ci包的changelog,看起来1.2.3 并没有真正的解决问题。
查看源码,内部是有对于 `streaming` 的支持,并没有区分是小程序还是小游戏。
因此这个配置没有隐患,猜测是因为小游戏问题反馈而做的修正,所以小游戏文档更新了,而忘记了给小程序的文档做更新。