云函数可以发送阿里云短信么
都是node.js,写的同样的代码,在阿里云的测试环境可以发送成功,在小程序的云函数里,返回成功,但是就是没收到短信,也没报错啥的。
什么原因呢?
// 云函数入口文件 const cloud = require( 'wx-server-sdk' ); const Core = require( '[@alicloud](/user/alicloud)/pop-core' ); cloud.init() // 云函数入口函数 exports.main = async(event, context) => { var client = new Core({ accessKeyId: '******' , accessKeySecret: '******' , endpoint: 'https://dysmsapi.aliyuncs.com' , apiVersion: '2017-05-25' }); console.log( 2 ); var params = { "RegionId" : "cn-hangzhou" , "PhoneNumbers" : "139******195" , "SignName" : "******" , "TemplateCode" : "SMS_10******" , "TemplateParam" : '{"code":"445466"}' } console.log( 3 ); var requestOption = { method: 'POST' }; console.log( 4 ); client.request( 'SendSms' , params, requestOption).then((result) => { //console.log(result); return result }, (ex) => { return ex }) console.log( 5 ); } |