aws-sam-cli
aws-sam-cli copied to clipboard
How to access /var/runtime/UserFunction.js?
Describe your idea/feature/enhancement
I got a mystic error (await needs to be in async) but error only traces back to UserFunction.js, how can I access this file so I can locate the exact problem?
Proposal
Show how it is done, and probably add a section in document.
Thanks!
Thanks for the Report! Can you be more specific about you are trying to do, and what led to this error?
I got an error await can only be used in async function, but the error message in console only traces back to a line in /var/runtime/UserFunction.js, but it is not the file name I used in my code.
I had to remove code piece by piece and finally found the problem. If I could just open that file, which I presumed is generated by SAM, then the error will be prominent.
I occasionally run into such errors without clear indication of the source file, so I wonder whether we can have some access to the generated UserFunction.js in some way.
Hope that's clear. Thanks!
Closing as issue seems to be resolved from above comment.
I want to follow up on this and try to get the same answer that the OP asked: the logging stack is impossible to understand without access to userFunction.js, and I have big lambda functions. Can we access it?
The error I'm getting is happening in the transpilation step (from TS -> JS via Webpack / Babel), this makes it very tricky to understand what's going wrong, because none of the pre-transpiled code current has any syntax errors like this one:
stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '.'"," at _loadUserApp (/var/runtime/UserFunction.js:98:13)","
I want to follow up on this and try to get the same answer that the OP asked: the logging stack is impossible to understand without access to
userFunction.js, and I have big lambda functions. Can we access it?The error I'm getting is happening in the transpilation step (from TS -> JS via Webpack / Babel), this makes it very tricky to understand what's going wrong, because none of the pre-transpiled code current has any syntax errors like this one:
stack":["Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '.'"," at _loadUserApp (/var/runtime/UserFunction.js:98:13)","
Did you solve it? I have similar issue with same stack.
@amouly Did you ever solve this problem? I am getting the same issue in the same file
Same problem here. Why is this closed? This is making debugging very difficult
UserFunction.js is a provided file within the Lambda Execution Environment. It comes up in debugging because it is what ends up executing your code.
This is not publicly documented, but you can see this file through running the docker container locally with a shell and cating the file.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.