admin管理员组文章数量:1022944
First, Cloudwatch logs aren't working for this function. Just get a message about how it failed to create a log stream. But I'm not sure that would help because when I invoke the function:
aws lambda invoke --function-name update-data out \
--payload '{"year": "2013"}' --log-type Tail \
--query 'LogResult' --output text | base64 -D
The stack trace is pretty worthless:
2019-06-30T23:17:31.684Z undefined ERROR Uncaught Exception
{"errorType":"Runtime.UserCodeSyntaxError",
"errorMessage":"SyntaxError: Unexpected identifier","stack":
["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected identifier","
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:36:30)","
at Module._pile (internal/modules/cjs/loader.js:701:30)","
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)","
at Module.load (internal/modules/cjs/loader.js:600:32)","
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)","
at Function.Module._load (internal/modules/cjs/loader.js:531:3)","
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)","
at startup (internal/bootstrap/node.js:283:19)"]}
[mild edits for readability]
The function is running in Node 10. I have a suspicion regarding the actual issue but it would be really helpful in the future if I could figure out a better way to get to the source of the failure.
Is there a way to get to the source of the Unexpected identifier
error? Line # and file in my code that caused that error?
First, Cloudwatch logs aren't working for this function. Just get a message about how it failed to create a log stream. But I'm not sure that would help because when I invoke the function:
aws lambda invoke --function-name update-data out \
--payload '{"year": "2013"}' --log-type Tail \
--query 'LogResult' --output text | base64 -D
The stack trace is pretty worthless:
2019-06-30T23:17:31.684Z undefined ERROR Uncaught Exception
{"errorType":"Runtime.UserCodeSyntaxError",
"errorMessage":"SyntaxError: Unexpected identifier","stack":
["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected identifier","
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:36:30)","
at Module._pile (internal/modules/cjs/loader.js:701:30)","
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)","
at Module.load (internal/modules/cjs/loader.js:600:32)","
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)","
at Function.Module._load (internal/modules/cjs/loader.js:531:3)","
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)","
at startup (internal/bootstrap/node.js:283:19)"]}
[mild edits for readability]
The function is running in Node 10. I have a suspicion regarding the actual issue but it would be really helpful in the future if I could figure out a better way to get to the source of the failure.
Is there a way to get to the source of the Unexpected identifier
error? Line # and file in my code that caused that error?
4 Answers
Reset to default 3I had a similar issue and my problem ended up being around importing a package that uses ESM when my project didn't support that.
I had a similar issue with AWS amplify function.
My problem caused by import syntax(ES2015). I use require syntax(node) instead of import syntax. And it works.
SyntaxError: Unexpected identifier","stack":
Says that the error is in your function code. Your using the "identifier" stack and it hadn't been declared mabe?
I've never used AWS lambda but, Runtime.UserCodeSyntaxError, sounds like the function encountered a runtime error ( during code execution ) related to the syntax of your code.
I didn't have experience with Python. But I had it with Java. In Java lambda function, I catch any exceptions and use e.printstackTrace() in the catch. The output goes to CloudWatch automatically
First, Cloudwatch logs aren't working for this function. Just get a message about how it failed to create a log stream. But I'm not sure that would help because when I invoke the function:
aws lambda invoke --function-name update-data out \
--payload '{"year": "2013"}' --log-type Tail \
--query 'LogResult' --output text | base64 -D
The stack trace is pretty worthless:
2019-06-30T23:17:31.684Z undefined ERROR Uncaught Exception
{"errorType":"Runtime.UserCodeSyntaxError",
"errorMessage":"SyntaxError: Unexpected identifier","stack":
["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected identifier","
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:36:30)","
at Module._pile (internal/modules/cjs/loader.js:701:30)","
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)","
at Module.load (internal/modules/cjs/loader.js:600:32)","
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)","
at Function.Module._load (internal/modules/cjs/loader.js:531:3)","
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)","
at startup (internal/bootstrap/node.js:283:19)"]}
[mild edits for readability]
The function is running in Node 10. I have a suspicion regarding the actual issue but it would be really helpful in the future if I could figure out a better way to get to the source of the failure.
Is there a way to get to the source of the Unexpected identifier
error? Line # and file in my code that caused that error?
First, Cloudwatch logs aren't working for this function. Just get a message about how it failed to create a log stream. But I'm not sure that would help because when I invoke the function:
aws lambda invoke --function-name update-data out \
--payload '{"year": "2013"}' --log-type Tail \
--query 'LogResult' --output text | base64 -D
The stack trace is pretty worthless:
2019-06-30T23:17:31.684Z undefined ERROR Uncaught Exception
{"errorType":"Runtime.UserCodeSyntaxError",
"errorMessage":"SyntaxError: Unexpected identifier","stack":
["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected identifier","
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:36:30)","
at Module._pile (internal/modules/cjs/loader.js:701:30)","
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)","
at Module.load (internal/modules/cjs/loader.js:600:32)","
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)","
at Function.Module._load (internal/modules/cjs/loader.js:531:3)","
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)","
at startup (internal/bootstrap/node.js:283:19)"]}
[mild edits for readability]
The function is running in Node 10. I have a suspicion regarding the actual issue but it would be really helpful in the future if I could figure out a better way to get to the source of the failure.
Is there a way to get to the source of the Unexpected identifier
error? Line # and file in my code that caused that error?
4 Answers
Reset to default 3I had a similar issue and my problem ended up being around importing a package that uses ESM when my project didn't support that.
I had a similar issue with AWS amplify function.
My problem caused by import syntax(ES2015). I use require syntax(node) instead of import syntax. And it works.
SyntaxError: Unexpected identifier","stack":
Says that the error is in your function code. Your using the "identifier" stack and it hadn't been declared mabe?
I've never used AWS lambda but, Runtime.UserCodeSyntaxError, sounds like the function encountered a runtime error ( during code execution ) related to the syntax of your code.
I didn't have experience with Python. But I had it with Java. In Java lambda function, I catch any exceptions and use e.printstackTrace() in the catch. The output goes to CloudWatch automatically
本文标签: javascriptHow do I get full logs out of aws lambda invokeStack Overflow
版权声明:本文标题:javascript - How do I get full logs out of aws lambda invoke? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745593949a2158049.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论