aws / aws/aws-lambda-runtime-interface-emulator

logs not showing correctly when using sam

オープン
#15 コメント 18 件 リアクション 52 件 担当者 0 名 GitHub で見る
bug
主要言語
Go
スター
1.1k
フォーク
118
平均マージ
42分
マージ済み PR(30日)
2

説明

**Description**
When using sam invoke, the output of `console.log` is not displayed correctly as described in [this issue](https://github.com/aws/aws-sam-cli/issues/1359).

**Steps to reproduce**
`console.log('line one\rline two\rline three\nline four\nline five')`

will output

> START RequestId: ac1ef293-d504-16a9-6b21-20a04c7f98e6 Version: $LATEST
> line fiveeT14:12:51.527Z ac1ef293-d504-16a9-6b21-20a04c7f98e6 INFO line one
> END RequestId: ac1ef293-d504-16a9-6b21-20a04c7f98e6

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

> This is due to some unfortunate internal changes in the runtimes where console.log is overwritten by a function that transforms all newlines to \r.

**Additional environment details**
os: OSX 10.14.6
sam cli versions tested: 1.3.0, 1.12.0, 1.13.2

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by reproducing the multiline console.log output with sam invoke using the examples in the issue, then trace how the runtime interface emulator handles console output and newline characters. Done means carriage returns and multiline logs, including pretty-printed JSON, are displayed correctly.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。