美文网首页
云函数报错Unexpected token *

云函数报错Unexpected token *

作者: _welostyou | 来源:发表于2020-03-26 17:16 被阅读0次

问题描述

  1. 小程序端调用云函数控制台报错
Error: errCode: -404011 cloud function execution error | 
errMsg: cloud.callFunction:fail requestID e54b29cb-56d2-11ea-aa7b-5254006250a6, 
cloud function service error code -504002, error message Unexpected token *; 
at cloud.callFunction api;
  1. 云函数日志信息

{“errorCode”:1,“errorMessage”:“user code exception caught”,“stackTrace”:“Unexpected token *”}

  1. 使用got发送http请求

问题原因

got新版的js文件在云函数端无法正常解析语法function*,可能是因为云函数端的nodejs版本较低。

问题解决

npm i got@9.6.0 --save

  • 法2:等待小程序更新修复

  • 法3:使用request-promise等其它模块发送http请求

相关文章

网友评论

      本文标题:云函数报错Unexpected token *

      本文链接:https://www.haomeiwen.com/subject/jlgcuhtx.html