nodejs runtime missing `cause` when unhandled error thrown

未关闭
#178 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
nodejs, typescript
领域
backend

调研方向

从 index.js 中的复现入手,检查会生成所示日志对象的未处理异常路径。使用仓库现有的运行时测试(如果有),验证最终的错误输出包含 errorCause 字段,且其值为 cause。

由索引模型根据 Issue 内容生成。

描述

For additional context see https://github.com/middyjs/middy/issues/994

index.js

export const handler = () => {}
throw new Error('error', {cause:'cause'})

logs

2023-01-26T07:46:54.151Z	undefined	ERROR	Uncaught Exception 	{
    "errorType": "Error",
    "errorMessage": "cold",
    "stack": [
        "Error: cold",
        "    at file:///var/task/index.mjs:86241:7",
        "    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)",
        "    at async Promise.all (index 0)",
        "    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)",
        "    at async _tryAwaitImport (file:///var/runtime/index.mjs:921:16)",
        "    at async _tryRequire (file:///var/runtime/index.mjs:970:86)",
        "    at async _loadUserApp (file:///var/runtime/index.mjs:994:16)",
        "    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:21)",
        "    at async start (file:///var/runtime/index.mjs:1200:23)",
        "    at async file:///var/runtime/index.mjs:1206:1"
    ]
}

Expect object to include"errorCause": "cause".

主要语言
TypeScript
星标
224
派生
60
平均合并
26 分钟
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws/aws-lambda-nodejs-runtime-interface-client 的其他 Issue

查看 aws/aws-lambda-nodejs-runtime-interface-client 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。