8***@qq.com
8***@qq.com
  • 发布:2023-01-10 22:31
  • 更新:2023-01-11 11:11
  • 阅读:325

正常使用云函数,网络正常,报错了,但是本地运行云函数可以使用

分类:uniCloud

检测本地调试服务出现错误:The "path" argument must be of type string. Received undefined,请检查网络环境或重启客户端再试
Uncaught (in promise) Error: 检测本地调试服务出现错误:The "path" argument must be of type string. Received undefined,请检查网络环境或重启客户端再试

2023-01-10 22:31 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

贴一下代码

  • 8***@qq.com (作者)

    // 637796acce2777000153fcb4     8010388 //传入的参数  
    const { msg } = await this.$http.update_follow_author({userId:this.userInfo._id, authorId:this.article_data.author.id});
    uni.showToast({
    title:msg,
    })

    2023-01-11 21:35

  • 8***@qq.com (作者)

    'use strict';

    const db = uniCloud.database();

    const dbCmd = db.command;

    exports.main = async (event, context) => {

    const {

    userId,

    authorId

    } = event;


    const user = await db.collection('user').doc(userId).get();

    const authorLikesIds = user.data[0].author_likes_ids

    let returnMsg = ''


    let author_ids = null

    if (authorLikesIds.includes(authorId)) {

    returnMsg = '取消关注成功'

    author_ids = dbCmd.pull(authorId)

    } else {

    returnMsg = '关注作者成功'

    author_ids = dbCmd.addToSet(authorId)

    }


    // 将处理完的内容进行重新插入

    await db.collection('user').doc(userId).update({

    author_likes_ids: author_ids

    })


    //返回数据给客户端

    return {

    code: 0,

    data: {

    msg: returnMsg

    }

    }

    };

    2023-01-11 21:35

  • 8***@qq.com (作者)

    我好像知道了,谢谢

    2023-01-11 21:37

  • 2***@qq.com

    回复 8***@qq.com: 什么原因,我也遇到了

    2023-04-22 15:41

  • DCloud_uniCloud_WYQ

    回复 2***@qq.com: 检查下是不是云函数名没填

    2023-04-23 11:41

  • DCloud_uniCloud_WYQ

    我们优化下提示语

    2023-04-23 11:43

要回复问题请先登录注册