云函数中获取客户端的cookies时,其中代码:
const cookie = require('cookie')
在云函数日志中查询错误原因如下:
请求入参: {
"args": {
"id": 123,
"content": {
"a": 1,
"b": 2
},
"clientInfo": {
...
}
},
"requestId": "ac1cc2ff1713424624286117033"
}
[istest/ac1cc2ff1713424624286117033/98ms/ERROR] Cannot find module 'cookie'
Error: Cannot find module 'cookie'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/tmp/function/__index.js:3:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
请求响应状态: fail
1 个回复
seng (作者)
云函数不支持require('cookie') 吗