-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logs not showing correctly when using sam #15
Comments
I'm also seeing this, but NOT related to use of SAM. Just using a docker image (extended from The JSON object being logged (in my case the This one statement is supposed to be logging a JSON event object containing multiple layers of data. As seen in the screenshot:
|
Any update on this? Quite annoying to see logs printed like this. |
I'm also seeing this issue under this environment: SAM CLI, version 1.19.1 It would be great if this issue could be fixed asap. Thanks |
also seeing this -
As a workaround: Thanks to @code-is-art for the workaround |
Current version of the container aws-lambda-runtime-interface-emulator has a bug which corrupts the output of sam local debug statements. This implements the workaround suggested in aws/aws-lambda-runtime-interface-emulator#15 (comment)
Anyone know if it's possible to use this workaround in windows? When I run it in CMD it does not start and I get no output. |
cross posting sorry aws/aws-sam-cli#1359 (comment) Hi there, However, this issue has been opened for two years and it seems like it should be fixed, can you either give a reason not fix the issue and add a gentle note to the sam cli documentation (with that workaround), or fix it? If not planning to fix, adding a note to the docs will save time to figure it out -- many people like me could waste a lot of time thinking they are doing something wrong. thanks |
Looking for a workaround for windows as well. tr isn't a natively available command in windows shell/powershell. |
@tw-Dan
Here is my full setup, wanting to output to the screen/console as well as to a log file since the
|
Thanks for taking the time to share this with me. I have been trying to fix this intermittently over the past few weeks! |
npm run dev --------> Error |
Possible workaround from codebase side is just replace
|
|
This is still an issue in Feb 2023 with macOS Ventura 13.1 and SAM version 1.73.0 If you're just trying to print an object to the console for debugging, wrapping the object in JSON.stringify seems to work better. i.e. changing |
This is still the best solution as of today. The problem with stringify is that non-serializable values are stripped out, and if you try to log an object on multiple lines without the solution above, you only see the first line. This really needs a fix. |
Just commenting that this still seems to be an issue. Not using SAM just running it through a regular docker container it appears that |
This is still an open issue. Hoping we can get a fix? edit: I just noticed https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/main/src/LogPatch.js#L86C23-L86C32, which seems like a likely culprit...so maybe not the RIE at all? edit:
|
In Windows, still not working :/ |
So it turns out.. the good old print statement works just fine. |
Description
When using sam invoke, the output of
console.log
is not displayed correctly as described in this issue.Steps to reproduce
console.log('line one\rline two\rline three\nline four\nline five')
will output
and
console.log(json.stringify({one: 'line one', two: 'line two', three: 'line three', four: 'line four'}, null, 2))
is just as problematic. One can only read the first and last lines, usually
{
and}
According to @mhart
Additional environment details
os: OSX 10.14.6
sam cli versions tested: 1.3.0, 1.12.0, 1.13.2
The text was updated successfully, but these errors were encountered: