SOURCE

// js的云函数入口:exports.main_handler = async (event, context)
// 参数context是云函数部署相关参数,不用考虑。

// 输入参数event, json类型:
// 云函数的固定入参 
var event = {
    // 崩溃类型, ExcepProcessType,1 for native,2 for crash(try catch异常),3 for anr
    type: "2",
    // 平台类型, appPlatform。1 for android, 2 for ios
    app_platform: "1",
    // 版本号, prodcutVersion
    product_ver:  "v1.0.1",
    // 还原后的堆栈信息, retraceCrashDetail
    crash_detail: "java.lang.RuntimeException: Unable to create service com.uxdc.tracker.server.TrackerServer:\njava.lang.IllegalStateException: You should Call MMKV.initialize() first.\nandroid.app.ActivityThread.handleCreateService(ActivityThread.java:3075)\nandroid.app.ActivityThread.access$2100(ActivityThread.java:170)\nandroid.app.ActivityThread$H.handleMessage(ActivityThread.java:1577)\nandroid.os.Handler.dispatchMessage(Handler.java:102)\nandroid.os.Looper.loop(Looper.java:179)\nandroid.app.ActivityThread.main(ActivityThread.java:5769)\njava.lang.reflect.Method.invoke(Native Method)\ncom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)\ncom.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)\ncause by:\njava.lang.IllegalStateException: You should Call MMKV.initialize() first.\nandroid.os.Parcel.readException(Parcel.java:1638)\nandroid.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)\nandroid.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)\nandroid.content.ContentProviderProxy.query(ContentProviderNative.java:421)\nandroid.content.ContentResolver.query(ContentResolver.java:510)\nandroid.content.ContentResolver.query(ContentResolver.java:452)\nsp.a(BrowserMonitor.java:35)\nsp.d(BrowserMonitor.java:163)\ncom.uxdc.tracker.server.TrackerServer.g(TrackerServer.java:329)\ncom.uxdc.tracker.server.TrackerServer.d(TrackerServer.java:301)\ncom.uxdc.tracker.server.TrackerServer.onCreate(TrackerServer.java:221)\nandroid.app.ActivityThread.handleCreateService(ActivityThread.java:3065)\nandroid.app.ActivityThread.access$2100(ActivityThread.java:170)\nandroid.app.ActivityThread$H.handleMessage(ActivityThread.java:1577)\nandroid.os.Handler.dispatchMessage(Handler.java:102)\nandroid.os.Looper.loop(Looper.java:179)\nandroid.app.ActivityThread.main(ActivityThread.java:5769)\njava.lang.reflect.Method.invoke(Native Method)\ncom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)\ncom.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)",
    // 关键堆栈行
    key_stacks: ["com.uxdc.tracker.server.TrackerServer.g(TrackerServer.java:329)", "com.uxdc.tracker.server.TackerServer.d(TrackerServer.java:301)"],
    // crash 关联人
    code_owners: ["codeOwner"],
    // 系统版本
    os_ver: "os1",
    // 机型
    model: "model1",
    // 其他硬件参数,用于ft分析
    device_id: "deviceID1",
    imei: "imei1",
    imsi: "imsi1",
    idfv: "idfv1",
    brand: "huawei 101",
    cpu: "i9",
    cpu_type: "cpuType1",
    cpu_name: "cpuName1",
    arch_ver: "x86",
    total_sd: "128GM",
    disk_size: "1GB",
    mem_size: "100MB",
    battery: "20 percent",
    // 附件 log.txt 的内容
    log_content: "testLogContent",
    // 用户自定义参数, userKeyValMap, key值以“_userParam_”开头, map类型,自由扩展
    user_param: {
        "pagInfo": "{\"pageId\":\"crash_report_activity\",\"reportData\":{\"pg_stp\":3,\"ref_pg\":{\"load_type\":\"0\",\"experiment_id\":\"423668\",\"pgid\":\"page_home_channel\",\"ztid\":\"100101\"},\"cre_pg\":{\"load_type\":\"0\",\"experiment_id\":\"423668\",\"pgid\":\"page_home_channel\",\"ztid\":\"100101\"},\"pgid\":\"crash_report_activity\"}",
        "stage": "CrashReportTestActivity",
        // map类型,自由扩展字段
    },
}

// 返回值:retMsg,string类型的array(注意是jsonArray),内容需转为字符串返回
var retMsg = [
    {
    // tag类型,classify or FT。填枚举值,1 for classify, 2 for FT
    user_tag_type: "",
    // 标签名,自定义或ftnames
    key: "tag_key_1",
    // 标签值, string array
    values:  ["val_1", "val_2"],
    // 自定义用户数据,如分类归类原因,最长32个字节
    customData: "",
    },
]
console 命令行工具 X clear

                    
>
console