[英]Error while deploying AWS Lambda S3 tutorial code
I am executing the AWS Lambda S3 tutorial from https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html我正在从https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html执行 AWS Lambda S3 教程
I have installed node.js v12 on an ec2 Amazon Linux v2 instance.我已经在 ec2 Amazon Linux v2 实例上安装了 node.js v12。 After following all the instructions in the tutorial, I get the following error in the CloudWatch error logs.
按照教程中的所有说明进行操作后,我在 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)" ] }
The code is available on the tutorial page.该代码可在教程页面上找到。
PS: The code was running properly when AWS lambda was supporting node.js v4 runtime. PS:当 AWS lambda 支持 node.js v4 运行时,代码运行正常。 Hence I assume the error is due to some change in Syntax.
因此我认为错误是由于语法的一些变化造成的。 I have searched the error string on google but did not find any relevant link.
我在谷歌上搜索了错误字符串,但没有找到任何相关链接。
This issue is now resolved.此问题现已解决。 I was using the wrong aws region in input.txt file.
我在 input.txt 文件中使用了错误的 aws 区域。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.