Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

云函数下发送短信错误,本地发送短信正常 #86

Open
AntoninSorrento opened this issue Jul 17, 2021 · 5 comments
Open

云函数下发送短信错误,本地发送短信正常 #86

AntoninSorrento opened this issue Jul 17, 2021 · 5 comments

Comments

@AntoninSorrento
Copy link

AntoninSorrento commented Jul 17, 2021

package.json 配置

WeChate3ed0b93ee94352fc2225d8ddfe62049

代码

const tencentcloud = require("tencentcloud-sdk-nodejs");

WeChatbdfcc9660599a516c93c12f147076491

错误信息

WeChat9294b13db55605d14252a0202a63560f

我遇到的情况和#69
的问题比较一致,只不过出问题的点不同,我也是将 node_modules 发布到 layer 层中引用的

@AntoninSorrento
Copy link
Author

AntoninSorrento commented Jul 18, 2021

经过多次测试发现,在云函数下,不能通过layer层调用该sdk 否则会报错

@ycp424c
Copy link

ycp424c commented Jul 19, 2021

云函数中有这个sdk的内置版本,优先级比layer高,如果放到layer里面要用绝对路径引用,否则会引用到内置的较低版本

@AntoninSorrento
Copy link
Author

AntoninSorrento commented Jul 19, 2021

请问如何强制引用,有相关文档吗?多谢解答
多说一句
不是应该让 layer 级别比内置级别高才合理吗,我都用 layer 了,还在乎函数内置版本嘛?
而且本地环境运行的版本可能会和内置的不一样,那么就会出现我这种,本地跑没问题,一上线就GG
仅个人观点。

@zqfan
Copy link
Member

zqfan commented Jul 20, 2021

建议到官网控制台提工单给云函数产品咨询下,在SDK这里提问可能无法解决问题。

@timtiger
Copy link

https://main.qcloudimg.com/raw/document/product/pdf/583_19677_cn.pdf
文档里面有说明:
如果在层中使用 SDK,请在代码中指定绝对路径,即 /opt/node_modules/tencentcloud-sdk-nodejs 。

其实按需安装包会更好,既避免了这个问题,也能减少体积
npm install tencentcloud-sdk-nodejs-ses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants