Any chance seed can parse out a JSON message and s...
# seed
g
Any chance seed can parse out a JSON message and show only the "message" field as the issue message if it is a JSON message? Rather than logging out multiple messages we just bubble up all of the request context into a single error log message and this results in an issue for every single error (or almost all sometimes they combine) even if they are the same.
f
Hey @Garret Harp, SEED supports the default Winston format, so if this is being printed:
Copy code
{
  "level": "error",
  "message": "...",
  "stack": "...",
}
Whatever is in the “message” will be extracted.
Can you show me an example of ur logged error?
g
Yeah sure, I use senselogs and this is what an error log looks like:
Copy code
{
  "@exception":{
    "stack":[
      "at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:52:27)",
      "..."
    ],
    "message":"Transaction cancelled, please refer cancellation reasons for specific reasons [None, ConditionalCheckFailed, None, None]",
    "code":"TransactionCanceledException",
    "name":"TransactionCanceledException",
    "time":"2021-11-24T16:29:07.427Z",
    "requestId":"IPVMD0BNIFN481M9GMF5G4ACJNVV4KQNSO5AEMVJF66Q9ASUAAJG",
    "statusCode":400,
    "retryable":false,
    "retryDelay":38.027943065468705
  },
  "body": { ... },
  "message":"Transaction cancelled, please refer cancellation reasons for specific reasons [None, ConditionalCheckFailed, None, None]",
  "@chan":"error",
  "@module":"app"
}
In seed it uses the entire JSON string as the error message displayed and because we include request specific context in the logs we get an issue for every single log even if it's the same issue
f
I see. How are you logging it in ur code? ie.
logger.error
?
g
Yes that's correct Logger.error(error) But I also include request context before hand (ie request body) Logger.addContext(requestBody)