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?

Share Improve this question edited Jul 2, 2019 at 1:37 jcollum asked Jun 30, 2019 at 23:25 jcollumjcollum 46.7k63 gold badges211 silver badges345 bronze badges 0
Add a ment  | 

4 Answers 4

Reset to default 3

I 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?

Share Improve this question edited Jul 2, 2019 at 1:37 jcollum asked Jun 30, 2019 at 23:25 jcollumjcollum 46.7k63 gold badges211 silver badges345 bronze badges 0
Add a ment  | 

4 Answers 4

Reset to default 3

I 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