我正在执行来自https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html的AWS Lambda S3教程
我已经在ec2 Amazon Linux v2实例上安装了node.js v12。按照本教程中的所有说明操作后,我在CloudWatch错误日志中得到以下错误。
{
"errorType": "Runtime.UserCodeSyntaxError",
"errorMessage": "SyntaxError: Unexpected token =>",
"stack": [
"Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token =>",
" at _loadUserApp (/var/runtime/UserFunction.js:98:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:45:30)",
" at Module._compile (internal/modules/cjs/loader.js:778:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
" at Module.load (internal/modules/cjs/loader.js:653:32)",
" at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
" at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
" at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)",
" at startup (internal/bootstrap/node.js:283:19)"
]
}
代码可以在教程页面上找到。
附言:当AWS lambda支持node.js v4运行时时,代码运行正常。因此,我假设错误是由于语法中的某些更改造成的。我在google上搜索了错误字符串,但没有找到任何相关链接。
发布于 2020-09-21 19:06:30
这个问题现在已经解决了。我在input.txt文件中使用了错误的aws区域。
https://stackoverflow.com/questions/63600170
复制相似问题