V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
lithium148
V2EX  ›  问与答

云函数在服务器执行和在本地执行效果不一致?

  •  
  •   lithium148 · 2020-09-07 15:47:48 +08:00 · 587 次点击
    这是一个创建于 1346 天前的主题,其中的信息可能已经有所发展或是发生改变。

    微信小程序

     exports.main = async (event, context) => {
       db.collection('isRunning').get({
     success:res=>{
       console.log("结果为::::::::"+res.data[0].taskId)
       return res.data[0].taskId
     }
     })
    
    放在本地执行能读取到结果,在云函数执行返回 null,且 console.log("结果为:::)也没有输出。
    
    
    谢谢!
    
    2 条回复    2020-09-08 10:54:18 +08:00
    whileFalse
        1
    whileFalse  
       2020-09-07 17:38:01 +08:00
    确定云函数能直接用 async ?
    lithium148
        2
    lithium148  
    OP
       2020-09-08 10:54:18 +08:00
    @whileFalse 确定,async 是编译器自己生成的,不是我写的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1161 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:36 · PVG 02:36 · LAX 11:36 · JFK 14:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.